Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Using href link values inside your select box

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 5.68k
    Comment on it

    In this post, you will learn how to connect select box option with the anchor tag link.
    Sometimes you want to change the select box value like an anchor tag with the refresh of page. Lets understand this with an example.

    If you have select box in your html code like this:
     

    <select name=language>
    <option value=english>English</option>
    <option value=hindi>Hindi</option>
    <option value=french>French</option>
    <option value=german>German</option>
    </select>

    Now, you want to refresh the page with the value selected from the select box. you can do the same thing with the anchor tag simply by giving the value to href attribute and it will refresh the page each time you click on anchor tag with the value associated with it.


    You can do this thing to select box by using the following code:

    <select name="language" onchange="location = this.value;">
     <option value=english.php>English</option>
    <option value=hindi.php>Hindi</option>
    <option value=french.php>French</option>
    <option value=german.php>German</option>
    </select>

     You can give the value in the option tag that you want to give on href attribute to work it in the same way. It will refresh the page on selecting an option with the value given to that option.

     

 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: