M
mouac01
I need to tell which DIV tag the event occurred on. For example, I
have 3 DIV tags. Inside each DIV tag I have an INPUT text with the
same name. Say if I change the value of the INPUT text in the second
DIV tag (line_2), how can I identify that the change occurred in that
DIV. I was hoping to use something like 'this.div' but that doesn't
seem to work. I don't want to hardcode each DIV id on the onchange
event. Thanks...
function oC(div){
alert(div.id);
}
<DIV id="line_1">
<INPUT type="text" name="fld" onchange="oC(this.div)">
</DIV>
<DIV id="line_2">
<INPUT type="text" name="fld" onchange="oC(this.div)">
</DIV>
<DIV id="line_3">
<INPUT type="text" name="fld" onchange="oC(this.div)">
</DIV>
have 3 DIV tags. Inside each DIV tag I have an INPUT text with the
same name. Say if I change the value of the INPUT text in the second
DIV tag (line_2), how can I identify that the change occurred in that
DIV. I was hoping to use something like 'this.div' but that doesn't
seem to work. I don't want to hardcode each DIV id on the onchange
event. Thanks...
function oC(div){
alert(div.id);
}
<DIV id="line_1">
<INPUT type="text" name="fld" onchange="oC(this.div)">
</DIV>
<DIV id="line_2">
<INPUT type="text" name="fld" onchange="oC(this.div)">
</DIV>
<DIV id="line_3">
<INPUT type="text" name="fld" onchange="oC(this.div)">
</DIV>