How to find out form element type by its name using jQuery. For example I have code below which set values for form elements. For edit boxes I will use first code and for radio buttons second code, but before accessing elements with code below I need to find out what type form element is.
Code #1
$("[" + attr + "='" + _name + "']", this).val(value);
Code #2
$("[" + attr + "='" + _name + "']", this).filter("[value=" + value + "]").attr("checked", "checked");
You would then be able to use an
if/elseor aswitchto execute the correct code based on the value of thetypeattribute.