I have searched on Google, jQuery, and stackoverflow for this issue and all basically give the same examples.
I followed the radio .change() examples explained, but I could not get it to work. My code is straightforward. The user must click either male or female. On change, the .change() is supposed to fire the alert(for test purposes) and the function. However, neither are firing. Both my jQuery and HTML code “look” correct, but I am not exactly sure why it is not firing.
HTML code:
<div class="float_right">
<label for="gender">*Gender:</label><br />
<input type="radio" name="gender" value="male" />Male<br />
<input type="radio" name="gender" value="female" />Female
<div id="gender_error">
<ul class="ul">
<li class="gender_error_1 element_error">Choose either male or female!</li>
<li class="element_valid">a</li>
</ul>
</div>
</div>
jQuery code:
$("input[name='gender']").change(function)(){
alert('Gender has changed!');
validateElement('#add_livestock', 'gender', '.gender_error_1')
});
The line
it should be