asp.net - My jquery selectors doesn't work after update panel in content page -


I have a content page, I write some jQuery selector after the ash: updatepanel, the first time the page is loaded (Document) .ready (function ()) works right, but after a postback, the selectors no longer work, any method exists to solve this problem ??

  & lt; Asp: content id = "content1" contentplaceholderid = "contentplaceholder1" runat = "server" & gt; Asp: UpdatePanel ID = "Update Pencil 1" Run = "Server" & gt; Content content & gt; & Lt; Asp: text box id = "txtdate" runat = "server" CssClass = "Persian DTP" & gt; & Lt; / Asp: text box & gt; Some code - & gt; & Lt; / Content title & gt; & Amp; Asp: UpdatePanel & gt; & Lt; Script & gt; $ (Document) .ready (function () ($. 'Persian DTP') .DadePicar ({showOn: 'Button', Button Image: 'Calendar.' ', DateF Ormat:' yy / mm / dd ', / / AppendText: '(yy / mm / dd)', changeMonth: true, changeYear: true, // selectOtherMonths: true, // showOtherMonths: true, showStatus: true, showButtonPanel: true, button image only: true, button text: 'Select a date', but close: function () {this.focus ();}}); JQuery (function ($) {$ (". PersianDTP") mask ("99 99/99/99"); });}); & Lt; / Script & gt; & Lt; / ASP: Content & gt;  

I found the answer to my problem - imagine Tneks Dear [jquerybyexample] [1] [1]:

include ur selector to create a JS file witch and use this functional structure :) this selector is required to use them in the script tag, enjoy Take it! :) /

  // In the content page & lt; Script type = "text / javascript" src = "ur_path" & gt; & Lt; / Script & gt; // in js file $ (document) .ready (function () {Sys.WebForms.PageRequestManager.getInstance (). Add_endRequest (EndRequest); function EndRequest (sender, Arges) {if (args.get_error () == undefined) {BindEvents ();}} function BindEvents () {// ur selector will sit here $ ('document'). Ready ({// ur jquery code}})}} BindEvents ();});  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -