What I'm trying to do is very simple, I want to pass string values to a JS function so that it can show them in the usual alert popup. Here's the HTML:
<div class="clickit" onclick="myfun('dog','cat')"> Hello </div>
and here's the JS:
('.clickit').click(function myfun(){
var i=0;
for(i=0;i<arguments.length;i++){
alert(arguments[i]);
}
});
Unfortunately it's not working properly, it prints out: [object Object].
Also, it's looping only once even if there are 2 arguments. I followed what is described in here: w3schools, yet it isn't working.
Any help will be appreciated.