0

I have this hierarchy, a tabcontainer(tcmain) under that a tabpanel(tpnlRaiseMRF) under that an asp panel(RaiseMRF) under that a checkbox(cbxRecNote). I want to add this function on click. I am adding like this :

$(document).ready(function () { $("#pnlRecNote").hide(); $("#cbxRecNote").click(function () { $("#pnlRecNote").slideToggle(); }); });

the pnlRecNote is directly under form, so its hiding. The cbxRecNote click is not getting fired(above code). but its not working, please help me. I am very new to jquery. Thanks in advance.

7
  • 1
    Have you tried a console.log instead of the slidetoggle to see if it's being trigered? Do you get any errors when you run that? Commented Sep 15, 2011 at 8:58
  • "I want to add this function on click." What's this function referring to? Also, what click event do you want to capture? Commented Sep 15, 2011 at 8:58
  • @JSantos : no i m not getting any error. Commented Sep 15, 2011 at 9:02
  • @Rob : On checking the checkbox i want to toggle the panel. Commented Sep 15, 2011 at 9:03
  • 1
    Can you manualy run the commands on console? If you do $("#pnlRecNote").slideToggle(); does it run? Can you find your elements within console? Also try replacing $("#cbxRecNote") with $("[id$=cbxRecNote]") and do the same for other elements Commented Sep 15, 2011 at 9:18

2 Answers 2

1

Replace your elements with $("[id$=cbxRecNote]")

Sign up to request clarification or add additional context in comments.

Comments

0

finding your checkbox is a straight forward way, just use your element's ID.

try this:

$("#cbxRecNote").change(function(){
// type your code here
});

this will take advantage of the browser's native javaScript getElementById() function which is the fastest way you can have.

check this live demo from here: http://jsfiddle.net/eS8eY/3/

3 Comments

@ElSayed : it can be accessed since its inside some other elements like tabcontainer having id (tcMain) and tabpanel having id (tpRaiseMRF).
@NayeemKhan: I know, but considering the direct usage of item's ID is much cleaner and speedy too.
@elsayed: in that way its not working also know. remember, a tabcontainer is ajax control, under that i have a tabpanel, under which i have panel which is containing my checkbox.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.