9
I have an anchor tag like
<a class="btn btn-danger" id="clicking" data-bind="click: $root.enterLocation" href="#">Continue</a>
It's inside a pop-up. I need to click on this link on pressing enter key. I have tried the following code but it did not work for me.
$(document).ready(function(){
$(document).keyup(function(event){
if (event.keyCode == 13){
$("#clicking").trigger('click');
}
})
});
Not sure why the functionality is not working. I have used click function also with same result.Its working correctly on mouse click. I need to make it work automatically on enter press.
Following code is working fine in Firefox.
$(document).ready(function () {
$(document).on("keyup", function (event) {
if (event.which == 13) {
document.getElementById("clicking").click();
}
});
});
How to make this work on Chrome?