简体   繁体   English

从灯箱调用js函数不起作用

[英]js functions not working when called from a lightbox

Javascript, jQuery functions are not working when called from a lightbox. 从灯箱调用Javascript,jQuery函数时不起作用。 I just want a div to be displayed, when I click on a link. 当我单击链接时,我只希望显示一个div。 But it doesn't work. 但这是行不通的。 When I tried checking by displaying an alert box, on click of the link, that also doesn't work. 当我尝试通过显示警报框进行检查时,单击链接时,该操作也无效。 What could be the possible reason. 可能是什么原因。 This problem is only on this page, the same function works in other pages. 此问题仅在此页面上,相同的功能在其他页面上也可以使用。 I have included all the necessary js files as in other pages. 我已经在其他页面中包含了所有必要的js文件。

EDIT 编辑

The html code in the lightbox: 灯箱中的html代码:

<div id="bottom_eqn_section" class="paddingTop_10">
  <a id="cost_allocation" href="#" class="arrowLink">Change cost allocation</a> 
  <div class="clear"></div>
  <a id="cancel" href="#" class="arrowLink ">Cancel</a>
</div>
<button type="reset" class="button1">OK</button>

 <script type="text/javascript">
$(document).ready(function (){

    $('#cancel').click(function(){
        alert('Hello');
    });

});
 </script>

I have added all the js files needed in the parent page. 我已经在父页面中添加了所有需要的js文件。

There is no js error. 没有js错误。 The Alert doesn't get displayed 警报未显示

将您的脚本放在父页面中,或在灯箱回调函数中添加该脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM