Capture the name of the select in HTML and JQuery

1

I would like to know if there is any way to capture the value of name of a select , that is, when I put a alert or a console.log I get 1 ó 2 ó 3 since I can not give it with the .val because I'm occupying it for another function.

    
asked by Ivan More Flores 15.06.2017 в 18:45
source

1 answer

4

This should work

var optName = $("#cb_unidad option:selected" ).attr("name");
alert(optName);

Greetings

    
answered by 15.06.2017 / 18:55
source