jquery - Change a buttons id on click -


i need change id attribute of div on click.

<div class="xtra" id="id1"><a href="#"><span>next</span></a></div>  

how that?

i've tried:

$j("#id1").attr('id', 'id2'); 

but didn't work.

try this:

$j("#id1").live('click',function(){       $(this).attr('id', 'id2'); //use 1       this.id = 'id2'; //or 1 <-- both same thing }) 

i not sure why ever want this, how it.

ids not meant change, meant unique specific element.

classes used when changing css , forth.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -