Roland Roland - 4 months ago 12
jQuery Question

How to get a value of an element by name instead of ID

How could I get the value of a element by name instead of by ID eg if I use by id it would be

$('#id').val();

Answer

Use the name attribute selector:

$("input[name=nameGoesHere]").val();
Comments