How would I alert the user if they selected more than one COP1000 and in another instance alert the user if they selected more than one COP 2830. Right now it notifies the user if they selected more than one class.
Below are checkboxes with data being the name of the class
Code:
<script type="text/javascript" charset="utf-8">
var p = 0;
$(document).ready(function () {
$('input:checkbox').click(function () {
var COP1000 = $(this).attr('data');
if ($('input:checkbox:is_checked').attr()) {
p++;
}
if (p >= 2) {
alert('You can only select this class once');
return false;
}
});
});
</script>
Code:
<input name="class[]" data="COP1000" value="<tr><td>COP1000 <td>8:00AM-9:00AM </td><td>MWF </td><td>Sanford </td><td>3</td></tr>" type="checkbox" class="auto- style88"/> <input name="class[]" data="COP1000" value="<tr><td>COP1000 <td>11:30AM-12:00PM </td><td>TTH </td><td>Altamonte </td><td>3</td></tr>" type="checkbox" class="auto- style88" /> <input name="class[]" data="COP2830" value="<tr><td>COP2830 <td>11:00AM-12:00PM </td><td>MWF </td><td>Sanford </td><td>3</td></tr>" type="checkbox" class="auto- style88"/> <input name="class[]" data="COP2830" value="<tr><td>COP2830 <td>6:00PM-8:45PM </td><td>T </td><td>Altamonte </td><td>3</td></tr>" type="checkbox" class="auto- style88"/>
Comment