so I have this following form that is on my website (partly generated by a wordpress plugin):
<p>Your University<br />
<span class="wpcf7-form-control-wrap your-university"><select name="your-university" class="wpcf7-form-control wpcf7-select wpcf7-validates-as-required">
<option value="Brock University">Brock University</option>
<option value="McMaster University">McMaster University</option>
<option value="Queen's University">Queen's University</option>
<option value="University of Guelph">University of Guelph</option>
<option value="University of Toronto">University of Toronto</option>
<option value="UofT Mississauga">UofT Mississauga</option>
<option value="UofT Scarborough">UofT Scarborough</option>
<option value="University of Waterloo">University of Waterloo</option>
<option value="York University">York University</option>
<option value="Western University (UWO)">Western University (UWO)</option>
<option value="Other">Other</option>
</select>
</span>
</p>
What I wanted as if the person on this form chose a certain item (i.e. McMaster University), that a javascript alert box would show up. So I put in the following code right above the aforementioned set of lines.
<script>
$(document).ready(function(){
$(':input#wpcf7-form-control-wrap your-university').live('change',function(){
var sel_opt = $(this).val();
alert(sel_opt);
if(sel_opt=="McMaster University")
{
alert("Message for McMaster");
}
else if(sel_opt=="York University")
{
alert("Message for York");
}
else if(sel_opt=="Other")
{
alert("Message for Other");
}
});
});
</script>
That being said, it's not working!! The one reason I can see why it might not work is that in the other examples i learned from, forms had but the plugin for wordpress doesn't generate anything like that... Can anybody help me modify the code so that it would work?
Thanks! :D