How to enable a jQuery Mobile button? - jquery-mobile

I'm using jQuery 1.6, and jQuery Mobile Beta 1. I have a jQuery Mobile themed button which I initialize as disabled. During a certain event, I'd like to enable the button. The following code is what I'd expect to work:
$("#id").prop("disabled", false);
But it seems like this doesn't propagate up to the jQuery Mobile wrapping DOM elements.

The solution, per the jQuery Mobile docs page Form Plugins Method is as follows:
$('#id').button('enable');

Related

.Bootstrap UI together with jQuery mobile UI?

i already build a website using bootstrap UI . and now i want implement small portion in that website using jquery mobile .bootstrap use keyword role and jquery mobile use keyword data-role so my question can use bootstrap and jquery mobile together . will it cause and conflict when using both in same page ?
No there is no conflict and you can use the libraries together. Try to load only the Jquery UI components that you need, this can be done by building a custom jQuery UI js file asset. It would include jQuery UI core and components such as the DatePicker and Draggable. That way you keep your 3rd party libraries smaller and thus increase page load speed.

How to completely disable Jquery mobile

We encounter the following problems with Jquery Mobile.
Our site is divided in a mobile and a fixed desktop site.
Both use the same database and php code. Only the templates are different.
On our mobile site we use Jquery mobile for a better user experience and that works fine. However we integrated a button "goto desktop".
This link should bring us back to our "normal" desktop site.
But there is the problem. In the desktop-site, Jquery mobile is still activated and it replaces drop down fields, input fields and make a complete mess of the desktop site.
We tried everything to disable JQM but nothing seems to work.
How we can switch from our mobile site template to the desktop site template and disable JQM completely when we are on the desktop template?
Thanks a lot for help!
There are few available solutions but only one will really do.
Working example: http://jsfiddle.net/Gajotres/NvEcW/
Few things are needed, first we need to set this:
<script>
$(document).on('mobileinit', function () {
$.mobile.ignoreContentEnabled = true;
});
</script>
it will give us an ability to programatically turn on/off content enhancement. If you already don't know this mobileinit event must be initialized before jQuery Mobile initialization but after the jQuery initialization. This must always be a part of a page.
There's one last step. When we want to move from mobile to desktop page we need to reload page and use this javascript:
$(document).on('pagebeforecreate', '#index', function(){
$(this).attr('data-enhance','false');
});
Pagebeforecreate event is important because at this point content is still not enhanced and attribute data-enhance = false will prevent any further page enhancement. If you want to turn it on again just set attribute value to true.
If you want more solutions then take a look at my other answer, search for the topic Methods of markup enhancement prevention : jQuery Mobile: Markup Enhancement of dynamically added content.

How to disable jquery mobile

I have a strange task, I need two types of popup windows for my site,
the first one is a normal popup, for desktop version of site
and another one is for mobile version of site
the question is: is it possible to enable jquery.mobile once I show popup for mobile version
and disable jquery mobile once I close the popup ?
(For your information: I do not use an iframe for my popups)
I found strange way how to enable jquery.mobile once I need it
but in this case I can't disable jquery.mobile
$(document).bind("mobileinit", function(){
$.mobile.autoInitializePage = false;
});
setTimeout(function(){
$.mobile.initializePage();// run jquery.mobile in 15 seconds for example
},15000);
You could alter the CSS of jQuery Mobile to add a "flag" so it only applies to elements within a specific container.
Here is a sample jQuery Mobile CSS rule declaration (just the selector):
.ui-li-has-arrow .ui-btn-inner a.ui-link-inherit
If you change this to:
.my-custom-class .ui-li-has-arrow .ui-btn-inner a.ui-link-inherit
Then the CSS will only be applied to elements within an element with the my-custom-class class. This means that you can have a regularly styled page most of the time, but when you want to use jQuery Mobile styles you just have to show your dialog in a container with the my-custom-class (or whatever you want to name your class).

customizing jquery mobile theme

I began to build jquery mobile based app and started to customize its theme with http://jquerymobile.com/themeroller/
but there is just not enough options for me to customize it, so I am asking is there some tool to customize it further?
however http://jqueryui.com/themeroller/# has more options but am not sure can I use it, beacuse its jquery and not jquery mobile

jQuery mobile events but without the UI

Is there a (simple) way to get the events functionality of jQuery mobile without any of the UI elements?
This is for upgrading a set of already written UI components to play nice in a mobile environment.
You will have to use data-role=page since those are what the JQM events are fired for.
For rest of the elements within the page you can prevent JQM from styling them using the data-enhance=false flag.
Read the Enhancement Section
From JQM Source
// The current version exposes the following virtual events to jQuery bind methods:
// "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel"
You should be able to bind to all these just like any other events using live/on/delegate

Resources