One standard asp.net way is to get the display identifier and use it in javascript like:
$(document).ready(function () { $('#<%=btnSubmitComment.ClientID%>').click(function () { var comment = $('#<%=txtComment.ClientID%>').val(); alert(comment); });
(from the moment you go with the identifier, and don't use any other way to select controls like css, type, etc.
source share