godofreality
11-03-2009, 07:05 PM
ok so i have this drag and drop script i am working on i got the drag part down and once the drag option is called up it is suppose to add an event listener to the page to detect when the user clicks the mouse
document.addEventListener("click", options('drop'), true);
options('drop') currently just alerts to tell me if the event listener is working but when i trigger the option that sets the event listener the listener triggers the alert long b4 i ever click and when i do click nothing happens
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
problem solved needed to code the event listener like this
document.addEventListener('click', options, true); //without the function argument
document.addEventListener("click", options('drop'), true);
options('drop') currently just alerts to tell me if the event listener is working but when i trigger the option that sets the event listener the listener triggers the alert long b4 i ever click and when i do click nothing happens
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
problem solved needed to code the event listener like this
document.addEventListener('click', options, true); //without the function argument