Freelance PHP Developer | Freelance PHP Programmer | PHP Freelance | Freelance Developer | PHP Freelancer | PHP Freelance Developers | PHP Developers | Freelance Developers | PHP Developer

[JavaScript] Get Option text of Selectbox using Javascript

javascript

Are you looking to get a selected option text using javascript ? You can easily find the selected value using javascript. but if you need to find the option text (selected text) using javascript, i am here to give you solutions. Have a look at below code to get selected dropdown text using javascript.


<script type="text/javascript">
function option_text(){
elm = document.getElementById('category');
alert(elm.options[elm.selectedIndex].text);
}
</script>

      
Tweet
You can leave a response, or trackback from your own site.
    PHP Freelance | Freelance Developer | PHP Developer | PHP Freelancer | Freelance Developers | PHP Developers
    Freelance PHP Developer