I am using FireFox only
I am attaching a eventListner to a <span id="someId"> </span> tag
I am trying to add and remove eventListners on the fly.
I have no problem adding the listner, which I do like this:
When the user clicks on the label <span>, they may choose to update the adjacent field with the new value. At this point I want to remove the listner
I tried the following:
It did not remove the listner. Also when I displayed the next record. the old listner with the old values stayed active. Plus the next record's new value was added.
I basically just need to figure out how to remove the eventListner I added on the fly.
I tried to follow the example give at https://developer.mozilla.org/en-US/...eEventListener
with no success.
This may not be enough info, so if you think you can help but need further clarification just say so.
I am attaching a eventListner to a <span id="someId"> </span> tag
I am trying to add and remove eventListners on the fly.
I have no problem adding the listner, which I do like this:
Code:
this.chkStat = function (lbl, elm, newValue)
{
if (newValue == elm.value)
{
//no listner attached if the values are the same
lbl.className = "myLowlight";
}else{
//listner attached if values not the same
lbl.className = "myHighlight";
if (lbl.addEventListener)
{
lbl.addEventListener("mousedown",
function(evt)
{
showRealValue(this, elm.id, newValue);
},
false)
};
}
}
I tried the following:
Code:
lbl.removeEventListener('click', showRealValue, false);
I basically just need to figure out how to remove the eventListner I added on the fly.
I tried to follow the example give at https://developer.mozilla.org/en-US/...eEventListener
with no success.
This may not be enough info, so if you think you can help but need further clarification just say so.
Comment