jquery - Update HTML of element on click toggle -


i'm trying update html of field in table when it's clicked. when it's clicked, class applied , alternates between 'headersortup' , 'headersortdown'.

this have far:

$(document).on('click', "table#archive-table thead tr th.headersortup", function(){      $(this).html('date <span class="ss-icon ss-gizmo">up</span>'); });  

i need add if class 'headersortdpwn' updates html date <span class="ss-icon ss-gizmo">down</span>

let me know if can or if haven't made myself clear.

thanks, r

update

http://jsfiddle.net/rx9pd/1/

try this:

$('#archive-table ').on('click', "th", function () {     if ($(this).hasclass('headersortup')) $(this).html('date <span class="ss-icon ss-gizmo">up</span>');     else if ($(this).hasclass('headersortdown')) $(this).html('date <span class="ss-icon ss-gizmo">down</span>'); }); 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -