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 6962223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:37:54+00:00 2026-05-27T15:37:54+00:00

i have an html page where i have multiple checkboxes each of them are

  • 0

i have an html page where i have multiple “checkboxes” each of them are call a function onclick.

Something like this

onclick="manage(val1, val2)

And in my function when i am getting the check status of checkbox, giving false every time.

function manage(val1, val2) {
    **if ($(this).is(":checked")) {** //returns false everytime
        //do something
        //
    }
    else {
        //do something
    }
}

please tell me where i am doing mistake…

Thanks in advance

  • 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-27T15:37:54+00:00Added an answer on May 27, 2026 at 3:37 pm

    When manage(val1, val2) is called, this will be the global object (or undefined if you’re in strict mode)

    But you can set the this value manually with call. Try this:

    onclick="manage.call(this, val1, val2);"
    

    Now this will be whatever you just clicked on.

    Just to clarify a bit more, inside the onclick="____" this is the thinig you clicked on. But once you call functions from there, this becomes the global object in the functions. So:

    onclick="foo(this);"
    
    function foo(val) {
        alert(this);
        alert(val);
    }
    

    Alerts [object DomWindow] (the global object) then [object HtmlInputElement] (the thing I clicked on)

    Without getting into too much detail, this is a result of how “function invocation” works in JavaScript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple javascript functions in my html page. One of them, by far
I have an html page with a link like this: <a href=javascript:window.print()>Print QR code</a>
I have multiple lists on one page (multiple categories of products) like this: <h3>Category
I have a html page with multiple similar elements which can be edited in-place:
I have extracted records from a database and stored them on an HTML page
I have a form on an HTML page with multiple submit buttons that perform
If I have a textarea on an HTML page with multiple lines of text
We have an HTML page with multiple div blocks. We want to separate these
I have a widget-like block of HTML+JavaScript that people can copy/paste into their HTML-page
I have a table on my web page that have checkboxes on them. I

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.