Im trying to add a div tag dynamically with some data attributes but the data attributes are not rendering in the right format.Please find the code below
$('<a href="#" id="opendialog2" data-role="button">Open Dialog2</a><div id="inlinecontent2" style="display:none" data-options="{"mode":"blank","headerText":"Yo","headerClose":true,"blankContent":true}"><ul data-role="listview"><li>Some</li><li>List</li><li>Items</li></ul><a rel="close" data-role="button" href="#">Close</a></div>').appendTo('#myDiv')
The div inlinecontent2 is rendered as
<div mode":"blank","headertext":"yo","headerclose":true,"blankcontent":true}"="" data-options="{" style="display: none;" id="inlinecontent2">
The data options attributes renders all messed up
Im wish to get it rendered like below
<div id="inlinecontent" style="display:none" data-options='{"mode":"blank","headerText":"Yo","headerClose":true,"blankContent":true}'>
You need to escape the quotes (differently):