0

I am using following markup code in my project.

<td>   
 <A style="FONT-SIZE: small" id=MainContent_RefDataMgr_GridRegion_lblRegionName_8 title="Click to select row" onclick=javascript:OnRowClick(this); href="javascript:__doPostBack('ctl00$MainContent$RefDataMgr$GridRegion$ctl10$lblRegionName','')">test </A>
    <INPUT id=MainContent_RefDataMgr_GridRegion_hdnRegionId_8 value=82 type=hidden name=ctl00$MainContent$RefDataMgr$GridRegion$ctl10$hdnRegionId> 
</td>




 function OnRowClick(objRow) {          
        var hdnSelectdGridRowRegionId =   document.getElementById('<%=hdnGridRowSelectedRegionId.ClientID%>');           
            hdnSelectdGridRowRegionId.value = objRow.nextSibling.nextSibling.value;            

    }

So if my Anchor element contains any extra space in his text (test ) then objRow.nextSibling.nextSibling.value is not working , i have to use objRow.nextSibling.value but In chrome it's working fine even if text contains any extra space or not.

Please let me know what could the region for this.

Thanks in advance.

Rahul Nikate
  • 6,192
  • 5
  • 42
  • 54
Pavan Tiwari
  • 3,077
  • 3
  • 31
  • 71
  • Use jQuery instead for cross-browser support $(objRow).next().val(); – icaru12 Dec 02 '14 at 07:04
  • @frosdqy thanks for your response. currently i am using jquery instead of it, but i wanted to know reason for that, because html and dom is same in both browsers then why i have to use two level of siblings. – Pavan Tiwari Dec 02 '14 at 07:12

1 Answers1

0

In IE8 the .nextSibling (correctly, IMHO) refers to the text node that is next to the <a>.

However, text nodes don't have a value.

You want .nextElementSibling.

Tomalak
  • 332,285
  • 67
  • 532
  • 628