1

I am new to JQuery Mobile and Javascript in general, so I am trying to learn it by doing a project. I am using JQuery mobile to design a web app and I require a few text inputs. In the JQuery documentation, there are text input examples that have a blue halo when they are clicked, and when the mouse moves away, the blue halo vanishes as well. I copied the provided code, but my text box does not have the same effect. I then tried inspecting the elements in the documentation and I realized that when the text box was clicked, the text input element gained an attribute called "ui-focus". How is this done?

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <script type="text/javascript" src="jquery.mobile-1.4.0/jquery.mobile-1.4.0.min.js"></script>
    <script type="text/javascript" src="js/jquery.js"></script>
    <link rel="stylesheet" href="jquery.mobile-1.4.0/jquery.mobile-1.4.0.min.css" />
    <link rel="stylesheet" href="jquery.mobile-1.4.0/jquery.mobile.structure-1.4.0.min.css" />
</head>

<body style class="ui-mobile-viewport ui-overlay-a">

    <div role="main" class="ui-content">
        <label for="basic">Email:</label>

        <div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset">
            <input type="text" name="name" id="basic" value=""/>
        </div>

        <label for="basic">Password:</label>

        <div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset">
            <input type="text" name="name" id="basic" value=""/>
        </div>
    </div>
</body>

1
  • 1
    Another note, you don't need the last style sheet structure unless you're using your own themes made by ThemeRoller. Commented Jan 1, 2014 at 21:33

1 Answer 1

1

You have copied rendered HTML code. JQM wraps input with a div to give it a new look. You don't have to add any extra code, only input tag, JQM will take care of the rest.

<input type="text" />
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.