Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

childNodes not working in Firefox and Chrome but working in IE

I have a gridview in its 3rd cell, there is textbox control, I am calling javascript function on onchange.

Can some body tell me why this is not working in Firefox and Chrome but working in IE

grd.rows[rowindex].cells[3].childNodes[0].value

It return correct value in IE but not in Chrome and firefox (In FF and Chrome it return undefined)?

Please also suggest me solution to handle this problem.

Edit

alert(grd.rows[ri].cells[3].childNodes[0].value);//IE value=correct value, FF and chrome value=undfined
alert(grd.rows[ri].cells[3].childNodes[1].value);//IE value=undfined, FF and Chrome value= correct value

Thanks

like image 570
Muhammad Akhtar Avatar asked Jan 23 '23 16:01

Muhammad Akhtar


1 Answers

I believe that this is because IE ignores text nodes that only contain newlines and tabs. Personally I prefer they be ignored but I would rather have consistency across the browsers.

<p><!-- This comment represents a text node.
    --><em>text</em>
</p>
like image 118
ChaosPandion Avatar answered Feb 09 '23 07:02

ChaosPandion