i have asp.net project, where i have a master-page on I include this line, to reference of the JS file
<script type="text/javascript" src="Scripts/HideDIV.js"></script>
In the JS file i have this function:
function hideDiv() { document.getElementById('div1').style.display = 'none'; document.getElementById('div2').style.display = 'none'; if (document.getElementById('RadioButtonTipoUser_0') != null) { if (document.getElementById('RadioButtonTipoUser_0').checked) { document.getElementById('div1').style.display = 'block'; } } if (document.getElementById('RadioButtonTipoUser_1') != null) { if (document.getElementById('RadioButtonTipoUser_1').checked) { document.getElementById('div2').style.display = 'block'; } } }
Basically i need on this RadioButtonList, call a function on Js "hideDiv()", when a select the one Button, one div hide pass to visible.
This code is in content.
<div> <asp:RadioButtonList ID="RadioButtonTipoUser" runat="server" RepeatDirection="Horizontal" onchange="hideDiv()"> <asp:ListItem Selected="true" Value="1">Dome</asp:ListItem> <asp:ListItem Value="2">Emp</asp:ListItem> <asp:ListItem Value="3">Vet</asp:ListItem> </asp:RadioButtonList> </div> <div id="div1" style="display:none"> <a>Charls</a> </div> <div id="div2" style="display:none"><a>Maris</a></div> </div>
I make a debug and the error msg is
ReferenceError: hideDiv is not defined
how i make tho the onchange="hideDiv()" call the HideDiv() function?
Bests