jquery mobile trigger('create') method doesn't work with iframe -
when try call .trigger('create') method iframe contents, not work , css classes not applied input:text elements. when call .trigger('create') method html content outside iframe, works
please go link 'here' on jsfiddle , click on "load mobile view"
javascript code
$('#mobile_view').contents().find('body').append("<div id='fbm_mob_menu'></div>"); $("#load_mobileview").click(function(){ var content = ' <form class="fbm_contactform">\ <div>contact us</div>\ <div data-role="fieldcontain"><label for="name" >name</label>\ <input name="name" type="text" class="m-field" /></div>\ <div data-role="fieldcontain"><label for="email">email</label>\ <input name="email" type="text" class="m-field" /></div>\ <div data-role="fieldcontain"><label >message</label>\ <input name="message" type="text" class="m-field" /></div>\ <input name="submitbutton" type="submit" class="m-field" value="send message" /></div>\ </form> '; $("#mobile_view").contents().find("#fbm_mob_menu").before(content); $("#mobile_view").contents().find(".fbm_contactform").trigger("create"); });
html code
<a href="javascript:void(0)" id="load_mobileview" >load mobile view </a> <iframe id="mobile_view"></iframe> <div id="test"></div>
iframe contents should not "easily" accessible, me correct behavior.
if check jquery mobile api examples, can see pages done using iframes , every iframe has it's own version of jquery mobile.
so if have iframe
, include jqm inside iframe , should allright.
Comments
Post a Comment