asp.net - JQuery looping not working -


i working on jquery loop on textbox such whenever classname="xyz" needs put datetime control there else textbox needs work regular textbox have set validations. having trouble looping through using jquery .each. can let me know if missing something.

<script>     $(".xyz").each(function () {          if ($(this).hasclass('xyz')) {             $(".xyz").datepicker();         }}) </script>  <asp:textbox id="txt" runat="server" cssclass="xyz"></asp:textbox> 

you don't need second class selector. inside loop targeting each element "xyz" class. use "this" keyword perform operation.

<script>     $(".xyz").each(function () {       $(this).datepicker();     }); </script>  <asp:textbox id="txt" runat="server" cssclass="xyz"></asp:textbox> 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -