Tuesday, December 14, 2010

Access DOM elements in ASP.NET Master/Content Pages using ClientID and jQuery

The example below will display Bill Murstein in asp.net textbox

Example:
1
2
3
4
5
6
var name = 'Bill Murstein';  
//javascript DOM  
document.getElementById('<%=txtCustomerName.ClientID%>').value = name;  

//jQuery Counterpart  
$('[id$=txtCustomerName]').val(name);  

0 comments:

Post a Comment