Function this parameter on onclick

Posted by Jerome on Stack Overflow See other posts from Stack Overflow or by Jerome
Published on 2012-06-26T15:09:26Z Indexed on 2012/06/26 15:16 UTC
Read the original article Hit count: 120

Filed under:

I've some html code generated in javascript like this

cell.innerHTML = '<a href="#" class="sortheader" id="sortheader_'+i+'" '+ 
        'onclick="ts_resortTable(this, '+i+');return false;">' + 
        txt+'<span class="sortarrow"></span></a>';

I'd like to call the function ts_resortTable() but independently of the onclick event how can i generate the "this" parameter of the function?

I tried the DOM selector : $('sortheader_'+i) in jQuery and the getElementById('#sortheader_'+i) as well but it's not working

© Stack Overflow or respective owner

Related posts about JavaScript