Get attribute name value of <input>
Use the attr
method of jQuery like this:
alert($('input').attr('name'));
Note that you can also use attr
to set the attribute values by specifying second argument:
$('input').attr('name', 'new_name')
Give your input an ID and use the attr
method:
var name = $("#id").attr("name");