Answers for "javascript set attribute to parameters"

14

set attribute javascript

Element.setAttribute(name, value);
Posted by: Guest on March-02-2020
0

javascript setattribute onclick function with parameters

var but = document.createElement('button');

var my_string = '123-45-lol , @%# ';

var but.setAttribute('onclick', 'my_function( " '+my_string+' " )');

// Or to use addEventListener() instead of setAttribute() ?
Posted by: Guest on April-06-2020

Code answers related to "javascript set attribute to parameters"

Code answers related to "Javascript"

Browse Popular Code Answers by Language