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
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
Post a Comment