jQuery to get the text attribute of a checkbox

Posted by Andriyev on Stack Overflow See other posts from Stack Overflow or by Andriyev
Published on 2009-12-31T03:55:39Z Indexed on 2010/03/24 3:43 UTC
Read the original article Hit count: 353

Filed under:
|
|

Hi

I'm adding a check box to a page using the following statement;

<script language="C#" runat="server">
    protected void Page_Load ( object src, EventArgs e ) 
    {
        if (!IsPostBack)
        {
         CheckBox XChkBox = new CheckBox(); //instance of System.Web.UI.WebControls.CheckBox
         XChkBox.ID = "someId"
         XChkBox.Text = "someText"
         somePlaceHolder.Controls.Add(XChkBox);
        }
    }
</script>

I need to get the Text attribute of that check box on click. I tried $(this).attr('Text'); inside $('input[type=checkbox]').click(function(){}); but it returns undefined.

Where am I going wrong? Please suggest.

cheers

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about checkbox