Reputation: 35
If I want to get field data by ID I will user: var contentText = $("#contentText").val();
How do I get field data by field name?
i.e.: <textarea name="contentText"></textarea>
Upvotes: 0
Views: 11457
Reputation: 16068
You can do that with attribute selector:
$("textarea[name='contentText']")
You can read more about it here: https://api.jquery.com/attribute-equals-selector/
Upvotes: 15