There are number of questions on this and I tried them out. However I am having an issue with the following anchor tag which acts as a button. Why isn't the link click event calling the function?
try 1:
<a href="#" class="btn" id="btnSubmit" data-type="submit">Submit</a>
try 2:
<a href="javascript:void(0)" class="btn" id="btnSubmit" data-type="submit">Submit</a>
js code:
<script>
$("#btnSubmit").click(function(){
dbdata = <%=jsscripts()%>;
addAll(0, this);
});
</script>
<script type="text/javascript" src="cart_Test.js"> </script>
NOTE:
Please note that this particular js function works well when it's called under the DOM load event listener.
UPDATE:
dbdata
is an array and addall() is a function defined in the cart_Test.js file. It seems, following script is not fired after the click function event.
<script type="text/javascript" src="cart_Test.js"> </script>
The order of the js:
<script>
document.addEventListener("DOMContentLoaded", theDomHasLoaded, false);
function theDomHasLoaded(e) {
//datepicker stuff
}
</script>
<script>
$("#btnSubmit").click(function(){
});
<script type="text/javascript" src="cart_Test.js"> </script>