2014-06-05 116 views
0

我有一个快速的问题 所以,我的代码是一样的东西:jQuery和引导3简单的解决

<html> 
<head> 
</head> 
<body> 

<?php 
    //file that contains the modals 
    include ('modals.php'); 
    <button class="openCompany"> 
     OPEN 
    </button> 
?> 
//... 
</body> 
</html> 

,并在最后,我有一个JS脚本来打开一个模式像:

<script type="text/javascript"> 
    $('#companyModal').modal('show'); 
</script> 

这完美的作品,但是当我做

$(".openCompany").click(function() { 
    $('#companyModal').modal('show'); 
}); 

它没有了。

谢谢。

回答

0

试试这个

$(document).ready(function(){  
     $(document).on("click", ".openCompany", function(e) { 
     $('#companyModal').modal('show'); 
    }); 
    });