How can i stop jQuery mobile to apply styles to my specific form elements

Happy picture Happy · Apr 11, 2012 · Viewed 36.5k times · Source

Is it possible to instruct jQuery Mobile to not style my Input box and submit button. I am good with my custom CSS. jQuery mobile script is applying its own style to all my elements.

the one workaround i tried is overriding those elements in my custom css. Is there any other functions available where i can do this ? some thing like this

$.ignoreStyles("button,text");

Answer

Frédéric Hamidi picture Frédéric Hamidi · Apr 11, 2012

jQuery Mobile will ignore elements whose data-role attributes are set to none. Therefore, you can simply add these attributes to your markup:

<input type="text" name="foo" data-role="none" />
<button type="button" id="bar" data-role="none">Button</button>