I'm trying to implement the new jQuery Mobile Alpha 2. Currently, any link within data-role="header"
or data-role="footer"
becomes a button. Is there a way to disable that?
Linking pages jQuery Mobile is designed to work with simple page linking conventions. Essentially, you can link pages and assets as you normally would, and jQuery Mobile will automatically handle page requests in a single-page model, using Ajax when possible.
Buttons API Buttons are core widgets in jQuery Mobile and are used within a wide range of other plugins. The button markup is flexible and can be created from links or form buttons. Basic markup Use anchor links (aelements) to mark up navigation buttons, and inputor buttonelements for form submission.
To enable or disable a button with jQuery, we have to use those two methods, attr () and removeAttr ().$ (‘.enableOnInput’).prop (‘disabled’, true); //TO DISABLED $ (‘.enableOnInput’).prop (‘disabled’, false); //TO ENABLE To do so, you have to add a disabled attribute to the submit button, as follows:$ (“#buttonSubmit”).attr (“disabled”, true);
Buttons are coded with standard HTML anchor and input elements, then enhanced by jQuery Mobile to make them more attractive and useable on a mobile device. Use anchor links (aelements) to mark up navigation buttons, and inputor buttonelements for form submission.
The new version of jQuery Mobile (1.3pre) has fixed this issue. From the manual:
"If you need to to create a header that doesn't follow the default configuration, simply wrap your custom styled markup in a container div inside the header container and the plugin won't apply the automatic button logic so you can write custom styles for laying out the content in your header."
If you grab the source from github it will work.
Another solution is to use a data-role="none" attribute:
<div data-role="header">
<a href="somewhere" data-role="none">Not a jQM button</a>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With