2

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.

Matthieu
  • 563
  • 1
  • 7
  • 25
  • 1
    isn't it named `data-enhanceD`? By default it is set to false, so JQM kicks in and does the enhancement. If you do it yourself, you should set it ``. But note that currently not all widgets have this option implemented. – frequent Jul 07 '14 at 10:34
  • 1
    No. it is `data-enhance` only, and not `data-enhanced` – Rajesh Jul 07 '14 at 10:35
  • data-enhanced is a new options in 1.4, that is designed to flag the manually enhanced elements. It could work in my case, except the element is considered by JQM as enhanced. Data-enhance remains in the documentation : http://api.jquerymobile.com/data-attribute/ – Matthieu Jul 07 '14 at 10:36
  • 1
    use `$.mobile.keepNative`. http://jsfiddle.net/Palestinian/egD6q/ – Omar Jul 07 '14 at 11:07
  • indeed. Or just data-role="none". But it doesn't explain why data-enhance doesn't work… Thanks anyway – Matthieu Jul 07 '14 at 12:53

1 Answers1

5

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

Matthieu
  • 563
  • 1
  • 7
  • 25
SRB
  • 1,031
  • 10
  • 16