Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Selecting a text field with name using JQuery

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 395
    Comment on it

    JQuery has loads of selectors that can be used to select an HTML Element from a page.

    One of the common scenario with development for even a simple case of validation requires to check for input fields and to do so we can use a selector that selects the Input field with a given name.

    Using the selector we can select a field in HTML a in example below.

    <input type="text" name="myField" value="myValue" />
    

    To get the value of this Input we can use code

    $("input[name='myField']).val() // which is myValue
    

    Hope this helps.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: