jeudi 25 novembre 2021

change onclick function of some DOM element inside particular function - example is given

i want to call a function with some variable which is inside it , when xyz function is runnning i want it to call self if function is running then i want to change an onclick function of one button example

<button id="xyz" onclick="abc()" >abc</button>

abc(){
a=2;
xyz(a);}


xyz(a){ 
document.getElementById("abc").onclick = "xyz(2)";
}

here when xyz function is called i want to change onclick variable of button. thanks for the help




Aucun commentaire:

Enregistrer un commentaire