I have worked with this pattern with an onclick handler in the HTML and the function in JavaScript.
Is there a more optimized means to fire an event listener / handler which could remove the need for inline HTML JS markup?
I want to pass an incremental unknown value from the input field to a function/constructor, which can take any inputted value.
HTML Code:<label for="gb">Add Stuff</label><input type="button" name="gb" id="gb" onclick="gbDo(this.name, 100)" value="+"></button>Code:function gbDo(type, amount) { if(type == "gb") { // code here }



Reply With Quote
Bookmarks