<table border=2>
<tr>
<td class="here" one="lorem" two="ipsum"> click </td>
<td class="here" one="aaa" two="bbb"> click </td>
</tr>
</table>
$('.here').click(function(){
$(this).html($(this).attr('one'));
})
How can i modify this javascript for function toggle or other solution?
I would like – if i click on TD then this show me attribute one, and if i next click then this show me attribute two, next one, next two etc
ocanal’s answer works perfectly but I thought I’d add that this can also be done with
togglewhich when given two functions will switch between them for each click:http://jsfiddle.net/7pUS4/