JQuery unable to find controls on a page -
i have jquery date mask, when run page throws error "microsoft jscript runtime error: object doesn't support property or method".
now, control particular jquery meant working added dynamically repeater control. through this, have looked @ ids of control, breaking , stopping in visual studio , being shown on aspx page. ids identical except of "#" jquery has @ start, not on page.
in jquery code have:
jquery(function ($) {
$('#<%=date.clientid %>').mask("99/99/9999"); });
is there away tell jquery not include "#" when finding control? have used uniqueid changes underscore "$", not same on page. problem "#" sign @ start of id.
can help?
thanks
<asp:textbox id="date" runat="server"></asp:textbox> <script type="text/javascript"> alert($('#<%=date.clientid %>').attr('id')); </script> this code alerts right id, '#' not problem. check if mask() valid function , if code runs before textbox on page. try:
$(document).ready(function(){$('#<%=date.clientid %>').mask("99/99/9999");}) note: <%=serversidecode %> block must on aspx page, not work in .js file!
or can add classname ives suggested, server side code isn't needed.
Comments
Post a Comment