3

Is there any way of using jQuery Mobile for only certain features such as toggle on/off switches but not have it take over the entire CSS?

2 Answers 2

1

You can use native form elements:

Related:

1

You can set this per element with a data-role="none" attribute on the element or bind to the mobileinit event like so:

$(document).bind('mobileinit',function(){
    $.mobile.page.prototype.options.keepNative = "select, input.foo, textarea.bar";
});

Notice how you can add classes to the selectors.

From the docs:

Or, if you'd like to prevent auto-initialization without adding attributes to your markup, you can customize the selector that is used for preventing auto-initialization by setting the page plugin's keepNative option (which defaults to [data-role="none"]. Be sure to configure this option inside an event handler bound to the mobileinit event, so that it applies to the first page as well as subsequent pages that are loaded.

Docs on this can be found here: http://jquerymobile.com/demos/1.0rc2/docs/forms/docs-forms.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.