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