Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In jQuery Mobile, how do I prevent a link becoming a button in the header or footer?

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?

like image 738
netwire Avatar asked Dec 22 '10 13:12

netwire


People also ask

How do I link pages in jQuery Mobile?

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.

What is API button in jQuery?

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.

How to enable or disable a button with jQuery?

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);

How do you make a button look good with jQuery?

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.


2 Answers

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.

like image 53
gleitz Avatar answered Oct 20 '22 23:10

gleitz


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>
like image 33
Fabrice Avatar answered Oct 20 '22 23:10

Fabrice