I have a web application in that I have button click event, which triggers a search. I am using JavaScript to also trigger this search when the user presses the enter key on the keyboard
In most browsers it is working fine but in Internet Explorer it always showing null values. Why would this be occurring?
document.getElementById('btnsearch').click()
<script type="text/javascript">
function checkEnter(e) {
var characterCode
if (e && e.which) {
e = e
characterCode = e.which
}
else {
e = event
characterCode = e.keyCode
}
if (characterCode == 13) {
document.getElementById('btnsearch').click();
return false
}
else {
return true
}
}
This is what I am using for button click event.
Give like this
Sure it will work.