I'm dynamically creating a div. I'd like to add a onClick() event to it.
How do I add an onClick as in <div class="something" id="btnHome" onClick="return true">
to this?
abc.append(
$('<div />', { class: 'something', id: 'btnHome' })
);
EDIT:
I'm looking for an answer something like this
$('<div />', { class: 'something', id: 'btnHome' onClick: 'return true' })
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…