Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
-2
rated 0 times [  4] [ 6]  / answers: 1 / hits: 21668  / 11 Years ago, mon, november 18, 2013, 12:00:00

Is this possible? And if so, how?¨
Is it possible to setAttribute onclick=myFunction() with a variable as parameter?



var variableCross = localStorage.getItem('cross'+localStorage.getItem('number'));
del.setAttribute(onClick,myFunction(variableCross););


myFunction(variableCross); sends variable like a string? doesn't it?



thx


More From » function

 Answers
2

Assuming this bit of code does what you want



var variableCross = localStorage.getItem('cross'+localStorage.getItem('number'));


Then this should work for you



del.addEventListener(click, function(event) {
myFunction(variableCross);
event.preventDefault();
});

[#74216] Saturday, November 16, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kalynn

Total Points: 309
Total Questions: 105
Total Answers: 90

Location: Azerbaijan
Member since Fri, May 12, 2023
1 Year ago
;