I am trying to modify the style
attribute of a LinkButton
using javascript
. I have successfully managed to do this for a DropDownList
, but not for the LinkButton
.
Below is my code snippet:
</asp:ListItem>
<asp:ListItem Text="vikas" Value="0">
</asp:ListItem>
</asp:DropDownList>
<asp:LinkButton ID="lnkbtnSave" Style="display: none" Text="Save" runat="server"></asp:LinkButton>
<asp:LinkButton ID="lnkbtnCancel" Style="display: none" Text="Cancel" runat="server"></asp:LinkButton>
<asp:TextBox ID="lnkbtnTest" Style="display: none" Text="hope" runat="server"></asp:TextBox>
<asp:LinkButton ID="lnkbtnChangeHR" Text="Change Hiring Manager:" runat="server"
OnClientClick="javascript:return Toggle(this.id);"></asp:LinkButton>
</div>
<script type="text/javascript" language="javascript">
alert('heart, please be careful');
function Toggle(id) {
alert(document.getElementById(id.replace("lnkbtnChnageHR", "lnkbtnTest")));
document.getElementById(id.replace("lnkbtnChangeHR", "ddlHiringManager")).style.display = 'inline';
document.getElementById(id.replace("lnkbtnChangeHR", "lnkbtnSave")).style.display = 'inline';
document.getElementById(id.replace("lnkbtnChangeHR", "lnkbtnCancel")).style.display = 'inline';
document.getElementById(id.replace("lnkbtnChangeHR", "lnkbtnChangeHR")).style.display = 'none';
document.getElementById(id.replace("lnkbtnChangeHR", "lnkbtnSave")).style.color = "#f6f6f6";
document.getElementById(id.replace("lnkbtnChangeHR", "lnkbtnCancel")).style.color = "#f6f6f6";
document.getElementById(id.replace("lnkbtnChangeHR", "lnkbtnTest")).style.display = 'inline';
alert(document.getElementById(id.replace("lnkbtnChangeHR", "lnkbtnCancel")).style.display == 'none');
return false;
}
</script>