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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:11:08+00:00 2026-05-16T10:11:08+00:00

i have a function call it: myFunction(A,B,C) I have onchange event in my option

  • 0

i have a function call it: myFunction(A,B,C)
I have onchange event in my option select that process "myFunction(A,B,C)"

<select id='B' onchange="myFunction(userid,B,C)">

I have two radio buttons that also have an onclick event that process "myFunction(A,B,C)"

<input type=radio, id="Cyes" onclick="myFunction(userid,B,Cyes)">
<input type=radio, id="Cno" onclick="myFunction(userid,B,Cno)">

I am using ajax to process the event dynamically.

my question is, in the onclick event for the radio button, i do not want “myFunction” to process the parameter “B”

and in the onchange event for the options, i do not want “myFunction” to process the parameter “C”

i am using the same function but i only want the parameters to be processed for that particular onlick/onchange event. i want them to be ignore and i dont want any values pass to the db.

i am not sure if this is doable, but if it is, your input is much appreciated.

thanks

  • 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-16T10:11:09+00:00Added an answer on May 16, 2026 at 10:11 am

    Try something like this by having arguments revert to default values if passing in null or undefined.

    
    function myFunc (A, B, C) {
        A = A || "some default value";
        B = B || "some default value";
        C = C || "some default value";
    }
    
    // use A and B, not C:
    myFunc('foo', 'bar');
    
    // use A and C, not B:
    myFunc('foo', null, 'something');
    

    Alternatively you could pass in an object for the arguments and not worry about order:

    
    function myFunc (argumentsObject) {
        var A = argumentsObject.a || "some default value";
        var B = argumentsObject.b || "some default value";
        var C = argumentsObject.c || "some default value";
    }
    
    // use A and B, not C:
    myFunc({a: 'foo', b: 'bar'});
    
    // use A and C, not B:
    myFunc({a: 'foo', c: 'something'});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple function, which I shall call myFunction . It takes two
I would like to have a function that can wrap any other function call.
I have function getCartItems in cart.js and I want to call that function in
I have a C program which has a function call that is defined in
I have a variable that I'm using to build a JavaScript function call, and
Suppose I have a function call from EF like: var result = context.myFunction(); the
I have a function call in a query, and that result has to be
i have a function that does this: static MyClass* MyFunction(myparams) { return new MyClass(myparams)
I have a function like this, that I would like to refactor function Myfunction(sUrl,
I have a function that looks like this: function MyFunction() { //do some work

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.