I’m a newbie with jquery so I’m still trying to test things out.
With php I’m generating div’s with a an id,
example :
<div id="myid-1"></div>
<div id="myid-2"></div>
and so on. if I click on a link I need to toggle that id. Here is my jquery code
$("#sublike").live('click', function(){
$(this).find(div[id^='sublike-form-']).toggle();
});
I’m doing something wrong, as firebug is saying undefined.
What is the correct why of findinf a dynamic div id to toggle it?
Thanks for the help.
I think you’re missing some quotes:
Also in your HTML example, the ids are “myid-1”, “myid-2, yet your jQuery is looking for Ids beggining with “sublike-form-“.