Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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"); 
like image 434
Happy Avatar asked Apr 11 '12 14:04

Happy


People also ask

Does jQuery mobile depend on jQuery?

However, jQuery Mobile is a full framework which is built on jQuery and jQuery UI foundation. It makes use of features of both jQuery and jQueryUI to provide both UI components and API features for building mobile-friendly sites.

What does jQuery mobile do?

jQuery Mobile is a HTML5-based user interface system designed to make responsive web sites and apps that are accessible on all smartphone, tablet and desktop devices.


2 Answers

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> 
like image 186
Frédéric Hamidi Avatar answered Sep 20 '22 15:09

Frédéric Hamidi


This works for me.

$(document).bind("mobileinit", function() {   $.mobile.ignoreContentEnabled = true; });  <div data-enhance="false">     <input type="checkbox" name="chkbox1" id="chkbox1"        checked />     <label for="chkbox1">Checkbox</label>     <input type="radio" name="radiobtn1" id="radiobtn1"        checked />     <label for="radiobtn1">Radio Button</label>   </div> 
like image 26
angelokh Avatar answered Sep 22 '22 15:09

angelokh