...

View Full Version : jQuery append()



coolz
01-07-2011, 12:08 AM
I have multiple list elements...

<li result[i+1]· <a> show comments(0) </a> · <a id='submit_agree' > <img src='gif/checkmark.ico'> agree </a> · <a id='submit_disagree'><img src='gif/cross.ico'> disagree </a> · <a id='submit_offtopic'><img src='gif/commenticon.ico'> go offtopic </a>
</li>

<ul id='comment'>
</ul>


This jQuery doesn't work:
<script type="text/javascript">
$(document).ready(function(){
$('a#submit_agree :selected').live('click', function(){
$('ul#comment :selected').append("<li>This text</li>");
});
});

</script>


What I want it to do is append to the current node in the list above. The one that the user has selected. The problem is they all same ID element, and I want it to append to the one that the user has selected.

Any ideas?

devnull69
01-07-2011, 06:56 AM
The problem is they all same ID element, and I want it to append to the one that the user has selected.
Any ideas?

Congratulations, you have identified the problem yourself! The ID attribute of all elements on a page must be unique. It can not work otherwise.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum