create button inside td tag javascript 1

create button inside td tag javascript

var btn = document.createElement('input');
btn.type = "button";
btn.className = "btn";
btn.value =;
btn.onclick = (function(entry) {return function() {chooseUser(entry);}})(entry);

Here is what the above code is Doing:
1. Create a table row
2. Create a table cell
3. Create a button
4. Set the button’s type to “button”
5. Set the button’s class to “btn”
6. Set the button’s value to the email address
7. Set the button’s onclick function to call the chooseUser function with the entry as a parameter
8. Add the button to the table cell
9. Add the table cell to the table row
10. Add the table row to the table

Similar Posts