javascript - How to pass text of clicked object to variable -


so want text fro of clicked , passed variable, echoing variable a.

this far have gotten, though doesn't work. how should this?

var aonetext = $(clickeda).text(); $('a.one').click(function(){         var clickeda = $(this);     $('a.two').text(aonetext); }); 

you not assigning text aonetext in event.

var aonetext; $('a.one').click(function(){         var clickeda = $(this);     aonetext = clickeda.text();     $('a.two').text(aonetext); }); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -