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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:35:29+00:00 2026-05-21T11:35:29+00:00

I created a huge form. I have to do many actions with Jquery. I

  • 0

I created a huge form. I have to do many actions with Jquery. I have completed the part where I can make actions. It is time for me to do controls.

By controls I mean, let’s say I will edit the data and I have to gather which form element is selected / checked etc., depending on variables I have to show extra form elements.

I already coded over 300 lines of Jquery just for actions. I have to do controls now but I don’t want to copy and paste and edit over 300 lines of Jquery code so I tried to go lazy way but it didn’t work.

// Category
if ($('input[name=category]:checked').val() == 1) {
    $('input[name=category]:eq(1)').click();
}
// Product
else if ($('input[name=category]:checked').val() == 0) {
    $('input[name=category]:eq(0)').click();
}
// Undefined Value
else {
    $('.frm_options').slideUp();
}

I have no idea why code above is not working. I could see it is changing checked attribute of radio button element but no it is not clicking so it will display the rest of the form.

/********************************************************************************************
                                    ACTIONS
********************************************************************************************/
$('input[name=category]').bind('click', function () {
    // Show rest of the form
    $('.frm_options').slideDown();

    // Product Specific
    if ($(this).val() == 0) {
        $('.frm_category_0').fadeIn(1000);
        $('.frm_category_1').fadeOut(1000);
    }
    // Category Specific
    else if ($(this).val () == 1) {
        $('.frm_category_1').fadeIn(1000);
        $('.frm_category_0').fadeOut(1000);
        }
        // Undefined Value, Hide everything
        else{
                $('.frm_options').slideUp();
                $('.frm_category_1').slideUp();
                $('.frm_category_0').slideUp();
        }
});

I guess it is more clear now what I am trying to do here. Simply I am trying to manipulate click function so I don’t have to write all the codes again.

Anyone knows solution for this problem I’m having? I will be really glad if anyone could help me out with my problem here.

Thank you 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-21T11:35:29+00:00Added an answer on May 21, 2026 at 11:35 am
    /********************************************************************************************
                                        ACTIONS
    ********************************************************************************************/
    $('input[name=category]').bind('click', function () {
        // Show rest of the form
        $('.frm_options').slideDown();
    
        // Product Specific
        if ($(this).val() == 0) {
            $('.frm_category_0').fadeIn(1000);
            $('.frm_category_1').fadeOut(1000);
        }
        // Category Specific
        else if ($(this).val () == 1) {
            $('.frm_category_1').fadeIn(1000);
            $('.frm_category_0').fadeOut(1000);
            }
            // Undefined Value, Hide everything
            else{
                    $('.frm_options').slideUp();
                    $('.frm_category_1').slideUp();
                    $('.frm_category_0').slideUp();
            }
    });
    
    
    // Category
    if ($('input.category:checked').val() == 1) {
        $('input.category:eq(1)').click();
    }
    // Product
    else if ($('input.category:checked').val() == 0) {
        $('input.category:eq(0)').click();
    }
    // Undefined Value
    else {
        $('.frm_options').slideUp();
    }// Category
    if ($('input[name=category]:checked').val() == 1) {
        $('input[name=category]:eq(1)').click();
    }
    // Product
    else if ($('input[name=category]:checked').val() == 0) {
        $('input[name=category]:eq(0)').click();
    }
    // Undefined Value
    else {
        $('.frm_options').slideUp();
    }
    

    You want to move your calls to .click below your .bind call. Otherwise your clicking on elements before you’ve attached the event handlers.

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

Sidebar

Related Questions

I have many items and many users in a database. A user can set
I am creating a huge Array in javascript...It's 4 levels deep and many elements
I have a Panel filled with a lot of controls for users to fill.
I'm running autoconf and configure sets SHELL to '/bin/sh'. This creates huge problems. How
I created a program using dev-cpp and wxwidgets which solves a puzzle. The user
I created a few mediawiki custom tags, using the guide found here http://www.mediawiki.org/wiki/Manual:Tag_extensions I
I created a single page (with code behind .vb) and created Public intFileID As
I created an Interop user control in VS2005. When the user control is shown
I created a simple .NET windows application in Visual Studio 2005 and on just
I created a Rails application normally. Then created the scaffold for an event class.

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.