I have some html with lines such as the following:
<ul>
<li onClick ="click(event, l1, url1)";>
..
<li onClick = "click(event, l2, url2)";>
..
etc.
If I take the onClick out I could iterate through the li elements and call attachEvent on each of them. But is there a simple way of dealing with the fact that the arguments differ for each event?
Rather than iterating you should use delegation with something like jQuery’s on function. As far as passing different arguments, that entirely depends on what those arguments signify. If they’re contextual they could be retrieved from the DOM or otherwise you could utilize the elements dataset.