I am able to set href properly like this:
var a = document.createElement("a");
a.setAttribute('href','doWork()');
However, I am clueless as to how do I do this when function needs a parameter:
var a = document.createElement("a");
a.setAttribute('href','doWork(money)';
#Using it like this, the url is doWork(money), but I need doWork(1), doWork(2)...
#I used a for loop, but doWork(i), when used with '' gives 'doWork(i)'.
#I have function doWork(money), with values of money ranging from 1 to 10.
How could I do that?
I have already tried this as per the links...mine is duplicate of.
for(var i=1; i<=10;i++){
var link = 'doWork(i)' #Sets link = doWork(i)
var link = doWork(i); #Nothing happens here
a.setAttribute('href','doWork(i)';