I am working on a site that displays multiple entries. Each entry can be expanded / collapsed, showing more / less information. The HTML for each entry is as follows:
<div id="entry-1"><div>some text</div><div><img></div></div>
<div id="entry-2"><div>some text</div><div><img></div></div>
<div id="entry-3"><div>some text</div><div><img></div></div>
1,2,3 in "entry- {1,2,3}" is the identifier of each message. How to associate a click event with each div?
I tried to do:
$('div[id^="entry-"]').click( myFunc($(this)) ) ;
But when I click, nothing happens, the click does not work, even if JavaScript is loaded when the page loads.
source
share