Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to get selected drop box text

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 177
    Comment on it

    Normally when we select a value from drop bax then we get the value of option. Here when we will select a value of option then we will getting text of option.

    SO to get selected drop box text use below code example-

    Javascript

    function get(text){
            var value = text.options[text.selectedIndex].text;
            alert(value);
    }
    

    HTML:

    Use get(this) in your html select tag.
    onchange="get(this);"

    DEMO:

    <script type="text/javascript"> function get(text){ var value = text.options[text.selectedIndex].text; if(value != '') { alert(value); } } </script>

 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: