jQuery Mobile: Arranging 2 Buttons using Grid-A

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

Say we need to put 2 submit and reset buttons side by side on a page.

We can use grid-a to format the page.

2 Buttons in Grid
<!DOCTYPE html>
<html>
<head>
    <link href='http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.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.1/jquery.mobile-1.4.1.min.js'></script>
    <title>Codecrawl</title>
</head>
<body>
<div data-role='page'>
    <div data-role='header'><h1>Grid A</h1></div>
    <br>
    <div class='ui-grid-a'>
        <div class='ui-block-a'><input type='submit' value='Submit' data-theme='a'></div>
        <div class='ui-block-b'><input type='reset' value='Reset' data-theme='b'></div>
    </div>

    <div data-role='footer' data-position='fixed'>
        <h1>Footer</h1>
    </div>
</div>
</body>
</html>
Try The Code

grid_a_buttons

Also, we have used 2 different themes for block a and block b.

Series Navigation<< jQuery Mobile: 3-column Grid B
jQuery Mobile: 3-Column Grid with Buttons >>

Leave a comment

Leave a Reply