- Impact
- 1
Alright, well I am trying to assign a function to a JavaScript Event for a retrieved element.
I will explain with code first :
If I attempt to do something similar to the above code, it executes 'someOtherFunction' rather than just setting the onclick event to the function with the proper arguments that I need to send it.
Any suggestions ? Thanks a lot guys
I will explain with code first :
Code:
window.onload = function() {
var divBox = document.getElementById(someid)
var divBox.onclick = someOtherFunction(arg,arg)
}
function someOtherFunction(arga,argb){
var anotherDiv = document.getElementById(someid)
anotherDiv.style.color='blue'
}
If I attempt to do something similar to the above code, it executes 'someOtherFunction' rather than just setting the onclick event to the function with the proper arguments that I need to send it.
Any suggestions ? Thanks a lot guys





