I have a live function that triggers the ‘openwindow’ function and I need to also be able to call that ‘openwindow’ function seperately, hence my ‘initial function call’. The problem is, the id #open-window featured in my live call is the id I want to be able to apply $(this) to (in the openwindow function). If anyone has any suggestions on how to make this possible, I would appreciate it.
function openwindow(user, token) {
if(user==''){
var user = $(this).attr('data-name');
var token = $('#token').attr('data-value');
}
//append some information
}
//event triggered on click
$('#open-window').live('click', openwindow);
//initial function call
openwindow('hey','hey');
Not sure of the exact functionality you want. But here is an attempt to modify what you had to use the event object that jQuery provides. You can use this object to store your own data (as I show) and get the original dom object.
Some documentation here.
http://api.jquery.com/category/events/event-object/