简体   繁体   中英

JQuery mobile changes html code

I'd like use jqm to detect swipe, but if I add that to my code I see HTML code changed!!

For example, input radio elements are wrapped by

<div class=" ui-radio"> </div>

Can I inhibit this behavior?

I've found the solution:

add this piece of script before you load the jQuery mobile library:

<script type="text/javascript">$(document).bind("mobileinit", function(){$.extend( $.mobile , {autoInitializePage: false})});</script>

This prevents jquery mobile from initializing the page and touching the DOM, thus leaving your layout alone (thanks to eivers88)

Adding data-role="none" to the element should stop jQuery Mobile from adding those additional classes.

Source: jQuery Mobile Demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM