M Coder M Coder - 1 year ago 77
jQuery Question

Button doesn't work on second click jQuery

I have a button that toggles a pop-up iframe whenever it is fired. The code is written on ASP.NET Webforms and jQuery

However, when I try to click it the second time, it doesn't fire anymore. I am wondering what is the cause of this.

Here is the jQuery code.

<script type="text/javascript">
$(function () {
var dStart = $("#MainContent_tbStart").val();
var dEnd = $("#MainContent_tbEnd").val();
var date = ("/Management/Site-Visit.aspx?StartDate=" + dStart + "&EndDate=" + dEnd);
if (dStart != "") {
var SiteVisit = $("#iframeSiteVisit").html('<iframe id="iVisit" width="100%" height="100%" scrolling="yes"></iframe>');
$("#iVisit").attr("src", date);
autoOpen: false,
bgiframe: true,
height: 600,
width: 1200,
modal: true,
close: function (event, ui) {
$("#bSiteVisit").click(function (e) {
} else {

Here is the ASP.NET Code.

<form id="form1" runat="server">
<button id="bSiteVisit" type="submit">View Site Visit</button>

Answer Source

I guess e.preventDefault() is not letting you to fire another click event of button. So click will do nothing on submit button - form won't be submitted. Please modify it resolve your issue.