- #1
Michael27
- 24
- 3
I have the following code creating an object on a web page:
My question is if the
part of the code below results in a unique instantiated function per anchor or will all anchors point to the same anonymous function and only one object is instantiated for all used anchors. How does the interpreter handle break points on this line of code?
Does this change when I remove the // from the commented out line in the example?
My question is if the
JavaScript:
function(event)
{
// var id=myid;
unbind(event, this);
}
part of the code below results in a unique instantiated function per anchor or will all anchors point to the same anonymous function and only one object is instantiated for all used anchors. How does the interpreter handle break points on this line of code?
Does this change when I remove the // from the commented out line in the example?
JavaScript:
function createElements()
{
createElemA('first', 'jsfirst',
function(event, obj)
{
... do something to handle the click of first
}
);
createElemA('second', 'jssecond',
function(event, obj)
{
... do something to handle the click of second
}
);
}function createElemA(myid, myjsid, unbind)
{
memberElemA1=$("<a href='#' class='close unbind' id='" + myid + "' jsid='" + myjsid + "'>×</a>");
memberElemA1.click(
function(event)
{
// var id=myid;
unbind(event, this);
}
);
}