JQuery to hide a button by default

I have 2 buttons which I want to hide by default on page load. On click of any row in the grid, I want these buttons to be visible. How can I hide the buttons using JQuery?

RadButton lnkAdd = new RadButton();
lnkAdd.ID = "BtnEdit";
lnkAdd.Text = "Edit";
container.Controls.Add(lnkAdd);

container.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "hideButtons",
    "\n<script type=\"text/javascript\">"
    //+ "\n$(function(){"           
    + "\n$(document).ready(function{"
    + "\n    $(\"#" + lnkAdd + "\").hide(); "                
    + "\n    return false;"
    + "\n  });"                
    + "\n</script>"
);

The following script is generated:

<SCRIPT type="text/javascript">
    $(document).ready(function ruchi(){
        $("#Telerik.Web.UI.RadButton").hide(); 
        return false;
    });
</SCRIPT>

But the buttons do not hide!

Answers:

Answer

Shouldn't it be + "\n $(\"#" + lnkAdd.ClientID + "\").hide(); " Right now it looks like you are just passing it the fully qualified name of the type and not the actual ID.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.