This #btncomfirmchoosecompany is a button on the bootstrap modal layer, but after clicking, the Click event is bootstrap the outer monitor hears, the effect is the modal popup layer is closed, so I do not want this click event is "passed" to the "outer" page.
Please note that the parameter E is missing from the beginning and the effect of the code does not meet my expectations.
$ ("#btnComfirmChooseCompany"). Click (function(e) {varCompanyName = ""; varCompanyID = ""; varhaschecked =false; varAllcheckbox = $ ("input[name= ' CompanyID ')"); for(vari = 0; i < allcheckbox.length; i++) { if(allcheckbox[i].checked = =true) {haschecked=true; CompanyID= $ (Allcheckbox[i]). attr ("value")); CompanyName= $("#" +CompanyID). Parent (). Next (). text (); } } if(haschecked) {$ ("#txtKHName"). Val (CompanyName); $("#hidCompanyId"). Val (CompanyID); } Else{alert ("Please choose a business!"); e. stoppropagation (); return false; } });
The other equivalent notation
$ ("#btnComfirmChooseCompany"). Click ( comfirmchoosecompany);
function Comfirmchoosecompany (e) { // Ibid., abbreviated }
Example of event bubbling in JavaScript understanding