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

  • Home
  • SEARCH
  • 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 9155703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:38:38+00:00 2026-06-17T12:38:38+00:00

My problem is, I want to retrieve checkbox id at runtime and use them

  • 0

My problem is, I want to retrieve checkbox id at runtime and use them later for other purpose.
But retrieved id is read as object.

My Code is:

 // Following code gives id of checkbox which contains myCheckbox as its id.

   var myCheckbox= $('input[id$=myCheckbox]')[0].id;

 //  and Now I want to check if that checkbox is checked with following code:


  if ($(myCheckbox).is(':checked')) 
    return 1;
  else 
    return 0;

But here myCheckbox id is read as Object instead of id and thus always enter in else condition and returns 0. This code works when I enter id of checkbox directly.

if ($('#ctl001_myCheckbox').is(':checked')) 
        return 1;
      else 
        return 0;

It shouldnot be so complicated, I have been working with Javascript but new to JQuery.

  • 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-06-17T12:38:39+00:00Added an answer on June 17, 2026 at 12:38 pm

    You are getting the ID correctly, but the jQuery selector requires the # symbol, much in the same way as a CSS selector does. You need to add the # character to your selector:

    if ($('#'+myCheckbox).is(':checked')) 
        return 1;
      else 
        return 0;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following code. my problem is i want to retrieve each employee
my problem is a bit similar to this : I want to retrieve rows
I am using mysql and facing some problem. I want to retrieve last row
Problem I want to use the interactive debugger with IntelliJ. Unfortunately, I can't convince
Problem: I want disparate sections of my code to be able to access a
I want to retrieve a PropertyInfo, Here the code : string propertyName=Text; PropertyInfo pi
I want to retrieve multiples values from a field. the code I am using
My JavaScript code stores a lot of data in arrays. I want to retrieve
i am using jsp file and i want to retrieve images the problem is
I have a problem with a JSP file. I want to retrieve the header

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.