I have a loop that creates a datastring for an ajax call. Here is the code:
$(':input','#texes-test-entry-0').not(':button, :submit, :reset, :hidden').each(function(){
varStr = $(this).attr("id").split('-');
dataString = dataString + '&' + varStr[1] + '=' + $(this).val();
});
For all of the text inputs $(this).val() gets me the value that I need, but for the select inputs, I don’t need the text value but the selected option value.
How do I catch the the select inputs and treat them differently?
Thanks
You don’t need to treat select elements differently, the
valmethod will get the selected value from the select.Example:
Output: