Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to set values of select box dynamically using Jquery

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 94
    Comment on it

    Hello Reader's if your building the html 5 based web form and want to set the value of select box via Jquery then you can learn it from code as below:-

    First you need to set the value from html page

    <input type = "text" id = "txtEmail" value  = "option1">
    <select id= "myoption">
    <option value="option1"> option1</option>
    <option value="option2"> option2</option>
    <option value="option3"> option3</option>
    <option value="option4"> option4</option>
    <select>
    

    Now make the script the get the values

    <script>
    val = $("#txtEmail").val();
    $("#myoption").val(val);
    </script>
    

    Now everytime script will load it will take value from element having id txtEmail and put into element which have id myoption

 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: