javascript style.visibility doesn't seem to work....
Posted
by Pandiya Chendur
on Stack Overflow
See other posts from Stack Overflow
or by Pandiya Chendur
Published on 2010-03-09T11:40:11Z
Indexed on
2010/03/09
11:51 UTC
Read the original article
Hit count: 191
In my aspx page i have a tr
which is set visible="false"
by default... But on a selected index of a dropdown i make it visible="true"
..... On the form submit i am validating the control within the tr
but couldn't find whether the tr
is visinle or not using javascript...
My aspx:
<tr id="MeasurementTr" runat="server" visible="false">
<td>
</td>
<td class="table_label">
Measurement</td>
<td>
</td>
<td>
<asp:DropDownList ID="DlMeasurement" runat="server">
</asp:DropDownList>
</td>
<td>
</td>
</tr>
and my javascript,
alert(document.getElementById("ctl00_ContentPlaceHolder1_MeasurementTr").style.visibility);
if (document.getElementById("ctl00_ContentPlaceHolder1_MeasurementTr").style.visibility=="visible"){
if (document.getElementById("ctl00_ContentPlaceHolder1_DlMeasurement").selectedIndex == 0) {
document.getElementById("ctl00_ContentPlaceHolder1_ErrorMsg").innerHTML = "Please Select Your Measurement";
document.getElementById("ctl00_ContentPlaceHolder1_DlMeasurement").focus();
return false;
}
}
But my alert shows nothing... It didnt show null
or undefined
...
© Stack Overflow or respective owner