click event handler on add button is not working if i do following(click event defined in add.js and ready event is present in index.js).
If i put click event handler and ready handler in index.js, click event works (alert popup).
Please help me.
Note: #add_button is a static button ( present in index.php, not a dynamic div, i tried live instead of click but that doesn't work too).
This doesn't work
<script src="js/index.js" type="text/javascript"></script>
<script src="js/add.js" type="text/javascript"></script>
index.js
$(document).ready(function() {
//code
});
add.js
$('#add_button').click(function(event){
alert('hello');
});
this works if add.js content is directly put into index.js ?
$(document).ready(function() {
//code
$('#add_button').click(function(event){
alert('hello');
});
});