How do I call a user-define function such as this one using the onClick attribute of a input button? More specifically what special steps must I take in JQuery and what would the HTML markup look like? Thanks
function simClick(keyCode) {
var e = jQuery.Event("keypress");
e.keyCode = 8;
$(document).trigger(e);
}
<input type="button" ID="delBtn" class="calcBtn" value="Del" onclick="???????" />
HTML
Javascript in separate file
There are many ways to attach a handler to when that button is clicked. Take a look at jQuery selectors.
You could also use the attribute equals selector
I’m not sure what you quoted JS has to do with the
inputbutton, since it looks like you’re trying to work with a keypress instead of a click in that function…. But the above jQuery is how you capture a click on thatinputbutton.Take a look at, “Which key was pressed?”