jQuery Mobile: Button on the right hand side of the header

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

Many app designers like to put a button on the top of the page.

For example, we put an info button on the right hand side of the header bar.

<!DOCTYPE html>
    <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>
<div data-role='page'>
    <div data-role='header'>
        <h1>I'm a header</h1>
        <a href='#' data-icon='info' class='ui-btn-right'>Info</a>
        <div data-role='navbar'>
                <li><a href='#'>One</a></li>
                <li><a href='#'>Two</a></li>
                <li><a href='#'>Three</a></li>
        </div><!-- /navbar -->
    </div><!-- /header -->

    <div data-role='content'>
        <p>You can put your content here...</p>

    <div data-role='footer'>
        <h1>My Footer</h1>

Try The Code

The line needed for the info button is:

<a href='#' data-icon='info' class='ui-btn-right'>Info</a>


Series Navigation<< jQuery Mobile: Navigation bar
jQuery Mobile: Navigation bar in the footer >>

Leave a comment

Leave a Reply