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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:19:11+00:00 2026-06-10T07:19:11+00:00

I search a JSON tree with jQuery on keyup-event. If the input is equal

  • 0

I search a JSON tree with jQuery on keyup-event. If the input is equal to the desired entry the input will disabled.

Now I need to call a function if they all are filled and correct. The if queries are long so i have written them into variables.

I’ve tried this, but it fails:

if (simple_present && simple_past && past_participle) {
    alert('All right!');
}

Now, when I write something like this, it works:

if (simple_present || simple_past || past_participle) {
    alert('All right!');
}

Here’s a fiddle of what I have so far.

Any ideas?

BTW: What is the best way to combine long if queries with reg expressions​?

  • 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-10T07:19:12+00:00Added an answer on June 10, 2026 at 7:19 am

    Consider this:

    var json = {
        "vocables": {
            "irregular": {
                "sein": {
                    "simple_present": "be",
                    "simple_past": "was were",
                    "past_participle": "been"
                },
                "schlagen": {
                    "simple_present": "beat",
                    "simple_past": "beat",
                    "past_participle": "beaten"
                },
                "werden": {
                    "simple_present": "become",
                    "simple_past": "became",
                    "past_participle": "become"
                }
            }
        }
    };
    
    var word = $( 'h1' ).text();
    
    $( 'input' ).on( 'keyup', function () {
        if ( this.value === json.vocables.irregular[ word ][ this.id ] ) {
            $( this ).prop( 'disabled', true ).next( 'input' ).focus();
        }
    
        if ( $( 'input:not(:disabled)' ).length === 0 ) {
            alert( 'SUCCESS' );
        }
    });
    

    Live demo: http://jsfiddle.net/NnAMu/1/

    As you can see, I have:

    • changed the JSON structure to suit my needs better,
    • cached the current word into a variable.

    With those changes, the resulting “keyup” handler code is much simpler.

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

Sidebar

Related Questions

I've three input fields to search a JSON tree. If all three fields are
I'm using Bing API to search for images by going the following call: http://api.bing.net/json.aspx?AppId=[my
I'm building a little app that uses the twitter search api: http://search.twitter.com/search.json?q=funny Now everything
jQuery code: $(document).ready(function() { $('#hit').click(function() { $.getJSON(http://search.twitter.com/search.json?q=stackoverflow&callback=?, function(data) { alert(data.length); }); }); // #button
https://search.twitter.com/search.json?q=doug How do I read this like VIEW SOURCE, so that I know what
I am having trouble access tweets via twitters json search https://search.twitter.com/search.json?callback=?&rpp=5&q=from:secretdreameruk The strange this
I am using this URL http://search.twitter.com/search.json to grab tweets with the hash tag #SameHashTag
I am using google Api for custom search and have done the json Parsing.
Iv read a lot of search results regarding how to deal with a JSON
I am using google api to get search result for certain queries in JSON

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.