I'm quite new to using jQuery with Javascript and I've got a bug where I need to analyse every part of a pre-written function.
Part of this function includes an if statement seemingly without a condition and I was hoping someone would be able to explain it to me, code below.
$("a").bind("click", myFunction);
function myFunction(event) {
if (event.target) {
// some code
}
}
My confusion here is what "if (event.target)" is equating to/testing as it is doesn't seem to be comparing anything. Any help or pointing towards reading material would be appreciated.
Thanks in advance!
.bind()has been deprecated. It was superseded by the .on() method for attaching event handlers to a document since jQuery 1.7"