As a relative beginner with JS, I am struggling to try and find a solution to this.
I need to find out which line of an unordered list was clicked
<ul onclick="alert(this.clicked.line.id);">
<li id=l1>Line 1</li>
<li id=l2>Line 2</li>
<li id=l3>Line 3</li>
</ul>
I don't really want to add a onclick event to each individual line, I'm sure there must be a way ??
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…