jQuery checkbox
Posted: Thu Jun 24, 2010 12:28 am
I have 5 checkbox, namely: A, B, C, D, E
When the user click on checkbox C, it will activate the jQuery and display the hidden div.
And this is my HTML:
My DIV:
[text]<div class="hide" id="Part-Time"><?php echo displayFields('Part-Time'); ?></div>[/text]
jQuery:
However, it doesn't work. Anyone?
When the user click on checkbox C, it will activate the jQuery and display the hidden div.
And this is my HTML:
Code: Select all
<input type="checkbox" id="typeJobs" name="typeJobs[]" value="Contract">Contract</option><br />
<input type="checkbox" id="typeJobs" name="typeJobs[]" value="Temporary">Temporary</option><br />
<input type="checkbox" id="typeJobs" name="typeJobs[]" value="Part-Time">Part-Time</option><br />
<input type="checkbox" id="typeJobs" name="typeJobs[]" value="Permanent">Permanent</option><br />
<input type="checkbox" id="typeJobs" name="typeJobs[]" value="Home-based">Home-based</option><br />
<input type="checkbox" id="typeJobs" name="typeJobs[]" value="Internship">Internship</option> [text]<div class="hide" id="Part-Time"><?php echo displayFields('Part-Time'); ?></div>[/text]
jQuery:
Code: Select all
$(document).ready(function(){
$("#typeJobs").click(function(){
if ($("#typeJobs:checked").val() == "Part-Time" ) {
$("#Part-Time").slideDown("fast"); //Slide Down Effect
} else {
$("#Part-Time").slideUp("fast"); //Slide Up Effect
}
});
});