Friday, February 27, 2009

using jquery to create check box for each item

if you want to create a check box each of the item with toggle functionality use this code snippet

<script type="text/javascript">
$(document).ready(function() {

$("#<%=btnSendEnquiryList.ClientID%>").click(function(event) {
var hasItemSelected = false;
$("#<%=dlNewDev.ClientID%> :checkbox").attr("checked", function() {
if ($(this).attr("checked") == true) {
hasItemSelected = true;
$(this).preventDefault();
} else {
hasItemSelected = false;
}
});


if (hasItemSelected == false) {
alert("There is no listing selected. Please select at least 1 listing.");
return false;
}
});

$("#<%=chkCheckedAll.ClientID%>").click(function() {
$("#<%=dlNewDev.ClientID%> :checkbox").attr("checked", function() {
if ($(this).attr("checked") != true) {
$(this).attr("checked", "checked")
} else {
$(this).removeAttr("checked")
}
});

});

});
</script>

3 comments:

Anonymous said...

topic78, [url=http://www.chop.edu/forum/user/profile/8207.page]buy klonopin[/url], :-) vya, http://www.chop.edu/forum/user/profile/8207.page buy klonopin without prescription :-(, [url=http://www.chop.edu/forum/user/profile/8208.page]xanax 2mg[/url], ;-( qav, http://www.chop.edu/forum/user/profile/8208.page xanax 2mg :-), [url=http://forum.cprs.ca/default.aspx?g=posts&m=6]order adipex[/url], :-) hjs, http://forum.cprs.ca/default.aspx?g=posts&m=6 order adipex online :-(, [url=http://forum.cprs.ca/default.aspx?g=posts&m=7]buy alprazolam no prescription[/url], :-( rvd, http://forum.cprs.ca/default.aspx?g=posts&m=7 buy alprazolam no prescription :-(, [url=http://forum.cprs.ca/default.aspx?g=posts&m=8]buy ambien without prescription[/url], :-( xdv, http://forum.cprs.ca/default.aspx?g=posts&m=8 ambien no prescription *sorry*

Anonymous said...

I’ve been visiting your blog for a while now and I always find a gem in your new posts. Thanks for sharing.

Anonymous said...

Ні thеre, I ԁiscοѵered уоur web site by means оf Google аt
thе ѕamе time as searchіng foг a
simіlar mattеr, уоur sitе came uр, it lοοκs good.
І've bookmarked it in my google bookmarks.
I'm not sure the placе уоu're getting your info, however good topic. I must spend some time learning more or understanding more. Thanks for great information I was in search of this info for my mission.

My homepage :: payday loans