var del = document.createElement('input'); del.type = 'button'; del.name = 'delll'; del.value = 'del'; del.onClick = 'alert("hi javascript")';
Here I dynamically create a BUTTON of input type and now I want to call a function when a button is clicked. For this, I use the onClick(); function onClick(); . Everything works fine in the above code, but del.onclick doesnβt work the way I want (to create a warning for demonstration)
I do not use any jquery code in this program, so please do not use jquery code.
javascript button dynamically-generated
user2750762
source share