I have a div
<div id="customFormContact">
.. other elements that don't matter ...
<input type="hidden" class="formID" value="Custom Product Contact" />
</div>
I am using the div to do a jquery dialog with the submit button doing some ajax work. In the ajax call I would like to do is pull out the value of the hidden field. What is the best way to do so?
I have tried
var id = $("#customFormContact, .formID").val();
As well as
var id = $("#customFormContact > .formID").val();
to no avail.
With an alert of the value, I get either a undefinded (with the first) or a blank with the second.
Leave off the
,(multiple selector) and>(child selector), just use a space like this:With only a space is a descendant selector, and it’ll find a
.formIDas a child of any depth inside#customFormContact.