ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.[Solved] Second Time jQuery Button Click event not working<p>Hi&nbsp;<a class="username" rel="SantoshC">SantoshC,</a></p> <p>Your Button&nbsp;click event not working for second time because it will not be attached to the DOM after first click. So instead of your code, you should use something like this.</p> <pre class="brush: js">$(&#34;body&#34;).on(&#34;click&#34;, &#34;#btnCreate&#34;, function(e) { $.ajax({ type: &#34;Get&#34;, url: &#34;/ClientMaster/AddClient&#34;, success: function (response) { $(&#34;#createContainer&#34;).html(response); $(&#39;#ModelPopup&#39;).modal(&#39;show&#39;); setTimeout(function () { $(&#34;.btnSave&#34;).on(&#34;click&#34;, function () { var formdata = new FormData($(&#39;form&#39;).get(0)); var file = document.getElementById(&#34;Imagelogo&#34;).files[0]; formdata.append(&#34;Logo&#34;, file); formdata.append(&#34;Imagelogo&#34;, $(&#34;#txtFile&#34;).file); formdata.append(&#34;ClientName&#34;, $(&#34;#ClientName&#34;).val()); formdata.append(&#34;Address&#34;, $(&#34;#Address&#34;).val()); formdata.append(&#34;Email&#34;, $(&#34;#Email&#34;).val()); formdata.append(&#34;website&#34;, $(&#34;#website&#34;).val()); formdata.append(&#34;ContactPerson&#34;, $(&#34;#ContactPerson&#34;).val()); formdata.append(&#34;PhoneNumber&#34;, $(&#34;#PhoneNumber&#34;).val()); $.ajax({ url: &#39;/ClientMaster/Create&#39;, type: &#34;POST&#34;, data: formdata, processData: false, contentType: false, success: function (data) { if (data != 1) { $(&#34;#createContainer&#34;).html(data); $(&#39;#ModelPopup&#39;).modal(&#39;show&#39;); return; } else { $(&#39;#ModelPopup&#39;).modal(&#39;hide&#39;); $.notify(&#34;Client Details Succesfully Added!&#34;, { align: &#34;right&#34;, verticalAlign: &#34;top&#34;, type: &#34;success&#34;, background: &#34;#20D67B&#34;, color: &#34;#fff&#34;, }); Listing(); } }, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.error); } }); }); }, 500); } }); });</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/104392/Solved-Second-Time-jQuery-Button-Click-event-not-working/https://www.aspforums.net:443/Threads/104392/Solved-Second-Time-jQuery-Button-Click-event-not-working/Mon, 01 Jul 2019 01:47:04 GMT