i have a little problem with jQuery. I want to append ID for element from other element after that i click on it... :) So, if i click some list element this element id will go to another, can you hel me? This is my code...
$('#main_menu li').click(function(){
(this.id).appendTo('.main_content ul')
})
$('#main_menu li').click(function(){
$('.main_content ul').attr('id', this.id);
});
Here this.id
will get the clicked element id
and set that id
to .main_content ul
.
id
duplication, which is not allowed.Instead of id
you can make class
:
$('#main_menu li').click(function(){
$('.main_content ul').attr('class', this.id);
});