I am using jQuery AJAX to dynamically load web user control's HTML via web service into one of my <div>
element.
This works absolutely fine, without any problem.
The problem arises when I use facebox
plugin to show that div
as a popup. I have Select All / None checkboxes in this div
which should select all checkboxes or deselect all of them.
When I click the links select all / none and try to select all checkboxes through jQuery, nothing happens and nothing reflects on my checkboxes until I close my popup and reopen it.
As soon as I reopen my popup iIcan see that all checkboxes are checked.
What might be the problem?
Without an example of your code, it's a little difficult to really understand what you want, but I'll make a guess. Here's one way to make a "select all" checkbox:
HTML:
<input type="checkbox" class="select-all" name="select-all" id="select-all" value="select all" />
<label for="select-all">Select All</label>
<input type="checkbox" class="checkbox" name="checkbox1" id="checkbox1" value="1"/>
<input type="checkbox" class="checkbox" name="checkbox2" id="checkbox2" value="2"/>
<input type="checkbox" class="checkbox" name="checkbox3" id="checkbox3" value="3"/>
<input type="checkbox" class="checkbox" name="checkbox4" id="checkbox4" value="4"/>
<input type="checkbox" class="checkbox" name="checkbox5" id="checkbox5" value="5"/>
jQuery:
$("#select-all").click(function(){
if ($(this).attr("checked") == "checked") {
$(".checkbox").attr("checked", "checked");
} else {
$(".checkbox").removeAttr("checked");
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.