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

jquery

Solution

Use the name attribute selector:

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

Problem

How could I get the value of an element via the attribute `name` instead of the `ID`. eg if I use by id it would be `$('#id').val();`

Original source