Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3602706
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:46:49+00:00 2026-05-18T20:46:49+00:00

I thought my question was answered over here at How to use JQuery with

  • 0

I thought my question was answered over here at

How to use JQuery with Master Pages?

but after trying the things suggested there, my code is still not working. I’m trying to get a checkbox control to toggle a hidden div below. Here’s the code in my external .js file;

  $(document).ready(function() {
             alert("hello world");
         });//works

        $('[id$=parking]').click(function() {
        $('#parktype').slideToggle('slow');//doesn't work
        });

and here is the code in my .aspx file

<td class="vanilla">
            <div id="park"></div><asp:CheckBox ID="parking" runat="server" /></div>
          </td>
         </tr>
        </table>
        </div>


        <div id="parktype" style="display:none;width:540px;padding:20px;margin:auto;">
        <table width="75%" border="0" cellpadding="5" cellspacing="0">
         <tr>

Last but not least I have linked my masterpage to the jQuery library;

 <script src="../jquery-1.4.4.min.js" type="text/javascript"></script>

As far as I can tell, the slideToggle function is not being triggered, and I suspect this is because of the difficulty in grabbing the name of a control in asp.net.

I’ve tried changing this:

 $('[id$=parking]').click(function() {

to many variations, including

 $('[id$=_parking]').click(function() {

 $('[id$="_parking"]').click(function() {

 $('[id$=ctl00_body_parking]').click(function() {

with the last variation being the ID given in the processed file;

 <td class="vanilla">
            <div id="park"></div><input id="ctl00_body_parking" type="checkbox" name="ctl00$body$parking" /></div>
          </td>

Not quite sure what I’m missing but thankful for any helpful hints, or whacks over the head indicating I’m just missing something really obvious…

Again, the goal is to have the div #parktype slideToggle when the asp.net control parking is clicked.
Merci!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:46:50+00:00Added an answer on May 18, 2026 at 8:46 pm

    Because your .js is external the document ready will not fire.
    I’m a little rusty on my asp.net controls but i think you can set your OnClientClick Event to

    <asp:CheckBox ID="parking" runat="server" OnClientClick="$('#parktype').slideToggle('slow');" />
    

    or
    you can set the OnClientClick to a function which passes in the checkbox itself

    <asp:CheckBox ID="parking" runat="server" OnClientClick="toggleParkType(this);" />
    

    Here’s a sample of the function

    function toggleParkType(chkbox){
        $(chkbox).slideToggle();
        //   test if checked
        if($(chkbx).is(":checked")){
         // perform action for checked
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have asked a similar question before here , but after much thought, and
this follows on from my last question which I thought was answered but for
I asked a similar question before, but it was answered inadequately so I thought
I thought I would post this here not so much as a question but
I thought I had answered this question before thanks to StackOverFlow, but I hastily
There is a jQuery quiz posted on the W3Schools site here... http://www.w3schools.com/quiztest/quiztest.asp?qtest=jQuery Question #16
This is going to be a self-answered question, but I thought that such a
I thought this question would have already existed on SO, but then I couldn't
After such a speedy response to my last question I thought I'd try my
First, I know this question doesn't exactly belong here, but I'll explain later why

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.