How to put single quote with in single quote in jquery string ?
Microsoft Net Framework

var buttonString = "<button onclick='window.webkit.messageHandlers.callbackHomePageHandler.postMessage('Redirecting to Home');' class='agree' style='color:#EE8B13;border:none;background:white;padding:0px 3px'> <b>here</b>&nbsp; </button>";

 

In above example, onclick event has single quote with in single quote. This syntax give error when its render in browser. 

Solution:  replace inner single quote with &#39;

var buttonString = "<button onclick='window.webkit.messageHandlers.callbackHomePageHandler.postMessage(&#39;Redirecting to Home&#39;);' class='agree' style='color:#EE8B13;border:none;background:white;padding:0px 3px'> <b>here</b>&nbsp; </button>"

Share This with your friend by choosing any social account


Upcoming Articles
Copyright Future Minutes © 2015- 2024 All Rights Reserved.   Terms of Service  |   Privacy Policy |  Contact US|  Pages|  Whats new?
Update on: Dec 20 2023 05:10 PM
03
07

New Messages

George Floyd
  • Edit Post Edit This Post within a Hour
  • Hide Chat Hide This Post
  • Delete Chat If inappropriate Post By Mistake
  • Report Inappropriate Chat
  • 4.5kb
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks
  • Hi James! Please remember to buy the food for tomorrow! I’m gonna be handling the gifts and Jake’s gonna get the drinks