jQuery Mobile: Button examples

This entry is part 12 of 73 in the series jQuery Mobile

We look at the different ways of implementing a button in jQM.

Button Examples
<!DOCTYPE html>
<html>
<head>
    <link href='http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css' rel='stylesheet'/>
    <script src='http://code.jquery.com/jquery-1.10.2.min.js'></script>
    <script src='http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js'></script>
    <title>Upwhere</title>
</head>
<body>
<div data-role='page' id='pageone'>
    <div data-role='header'><h1>Button App</h1></div>
    <div data-role='content'>
        <p>The 2 Class Button Examples</p>
        <a href='#' class='ui-btn'>Anchor</a>
        <button class='ui-btn'>Button</button>
        <p>Input Button</p>
        <input type='button' value='Submit Button'>

        <p>The deprecated data-role button</p>
        <a href='#pageone' data-role='button'>Old Button</a>

        <p>Inline Buttons</p>
        <a href="#" class="ui-btn ui-btn-inline">Anchor</a>
        <button class="ui-btn ui-btn-inline">Button</button>
    </div>
    <div data-role="footer" data-position="fixed">
        <h1>Footer</h1>
    </div>
</div>
</body>
</html>
Try The Code

jqm_button

Anchor button is commonly used for moving to a different page or web address.

<a href='#' class='ui-btn'>Anchor</a>

General purpose Button:

<button class='ui-btn'>Button</button>

Submit button:

<input type='button' value='Submit Button'>

The deprecated old Button:

<a href='#pageone' data-role='button'>Old Button</a>

Inline buttons are displayed on the same line.

<a href="#" class="ui-btn ui-btn-inline">Anchor</a>
<button class="ui-btn ui-btn-inline">Button</button>

We generally use input button to submit a form.

Series Navigation<< jQuery Mobile: Transitions
jQuery Mobile: Basic Check Box >>

Leave a comment

Leave a Reply