0

how i can get the text selected from select tag?

<select id="51" class="toque">
    <option value="1">Save</option>
    <option value="2">Delete</option>                                    
</select>

I want to get the text between option tag (Save or Delete).

  • 1
    Possible duplicate of [Get selected option text with JavaScript](https://stackoverflow.com/questions/14976495/get-selected-option-text-with-javascript) – cantuket Feb 24 '19 at 00:22
  • [Retrieving the text of the selected – cantuket Feb 24 '19 at 00:41

2 Answers2

4
var sel = document.getElementById("51");
var text= sel.options[sel.selectedIndex].text;
Wilson Madrid
  • 437
  • 2
  • 7
1
document.getElementById('51').selectedOptions[0].text;
cantuket
  • 1,582
  • 10
  • 19
  • dont want to get the value param, but the text value between the tag. – gaston graciani Feb 24 '19 at 00:22
  • I'd recommend closing this question in favor of [Retrieving the text of the selected – cantuket Feb 24 '19 at 00:49