Combining jQuery with PHP
I have a simple jQuery toggle script like this:
<script type="text/javascript">
$(document).ready(function() {
$('#clickedit').click(function() {
$('#st').toggle();
});
});
</script>
And of course in my HTML I have
<div id="clickedit">CLICK ITEM TO TOGGLE</div>
<div id="st">content to show/hide</div>
Now ... If I work with PHP and I repeat several "elements", and each "element" has its own content to show / hide, I can not set static identifiers for my divs, because the script simply will not work. I can assign the element id to my divs (something like echo "<div id='clickedit".$id."'>";and echo "<div id='st".$id."'>";), but I don't know how to handle them in my jQuery script! I just open jQuery and it is brilliant but still confusing for me :) So any help would be great!
Thanks in advance!