-
Book Overview & Buying
-
Table Of Contents
jQuery Mobile Cookbook
By :
Buttons are standard HTML form elements that are enhanced by the button plugin
in the jQuery Mobile framework to make them finger friendly and also to look good in a wide variety of mobile devices. You can add buttons to your app by using the <button> tag or the <input> tag. You can also style the anchor element as a button by adding the data-role="button" attribute to it. This recipe shows you how to dynamically add a button to a page using JavaScript and bind an action to this newly added button.
Copy the full code of this recipe from the code/04/dynamic-button sources folder. You can launch this code using the URL http://localhost:8080/04/dynamic-button/main.html.
In main.html, create the #main page and add a button to it. When you click on this button, use JavaScript and create a second button and also assign an action to it:
Create the #main page in main.html and add the following code content to it:
<div data...
Change the font size
Change margin width
Change background colour