asp.net - Javascript variable in asp block code -


i have lot of checkboxes needs execute same javascript function when checked/unchecked. parameter enclose control's server id. hope actual checkbox using id. problem need find client id, expected can't use javascript variable mycontrolsserverid inside asp code blocks id. stuck:

function show(mycontrolsserverid) {    var checkbox = document.getelementbyid('<%= mycontrolsserverid.clientid %>')    //more omitted code } 

how can clicked checkbox?

use jquery achieve this.

at document load initialize jquery listen checkboxes on page. moment click on 1 of these, can whatever want it:

$(document).ready(function() {     $("input:checkbox").click(function(e) {         alert($(this).attr('id'));     }); }); 

download latest jquery version on http://jquery.com/download/


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -