Jquery mobile 1.4 data-enhance=false don't work

倖福魔咒の 提交于 2019-12-24 04:14:25

问题


I'm trying to update my JQM app from 1.3 to 1.4, and on some element, data-enhance="false" doesn't work anymore… The elements remains enhanced…

jsfiddle : http://jsfiddle.net/matthieubrunet/RB9Qw/

<div data-role="page" id="home">
    <div data-role="header">
         <h1>JQM 1.4.3</h1>
    </div>
    <div data-role="content">
        <label for="yes">Yes</label>
        <input type="checkbox" name="yes" id="yes" data-enhance="false" />
    </div>
</div>

I tried to activate the ignoreContentEnabled option, but it doesn't work :

$( document ).on( "mobileinit", function() {
  $.mobile.ignoreContentEnabled = true;
});

Is it a bug, or am I missing something ?

Thanks a lot for your help.


回答1:


put your script

$( document ).on( "mobileinit", function() {
  $.mobile.ignoreContentEnabled = true;
});

just before loading jquery mobile js. official docs state that mobileinit gets called as soon as jquery mobile js gets loaded : http://api.jquerymobile.com/global-config/

Therefor the order should be:

jquery.js -> mobileinit binding script-> jquery.mobile.js



来源:https://stackoverflow.com/questions/24608502/jquery-mobile-1-4-data-enhance-false-dont-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!