is there any way to get $(‘#div’) inside callback function? $(‘#div’) changes
var param = {
a: 'haha'
}
$('#div').load('/foo.html', param, foo())
function foo() {
var div = caller? // this variable should be "$('#div')[0]"
}
is there any way to get $(‘#div’) inside callback function? $(‘#div’) changes
var param = {
a: 'haha'
}
$('#div').load('/foo.html', param, foo())
function foo() {
var div = caller? // this variable should be "$('#div')[0]"
}
2
Answers
this
will be the element that.load
was called on, eg:Your edit to the question translates as:
So in this case, no, because foo() will have already been called.
According to the documentation:
https://api.jquery.com/load/#load-url-data-complete
So: