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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:18:31+00:00 2026-05-26T22:18:31+00:00

UPDATE** This is probably too much code. But… heres the situation. I have a

  • 0

UPDATE** This is probably too much code. But… heres the situation. I have a search at the top of the page. I use some fancy jQuery so when you click on a select option(#categoris) a new select option(#type) appears next to it.

Now, I have another change event. On keyup of any text field or change of any select, an ajax search is fired. This works on everything but #type. #type is the select option that pops out from #categories on change(); So, I need change to work on #type.

Here’s the code pop out the #type select option. You can just skim. Code works fine…

    $(document).ready(function() {

    $('#category').change(function() {

        var category = $('#category').val();
        //CATEGORIES...

            // any_type / NULL
            var any_category = '<div id="type_holder_line"></div>';
            // Music
            var music = '<div id="type_text">Type</div><img src="app/search/images/arrow.gif" id="arrow" /><select name="music_type" id="type"><option value="any_style" selected="selected">Any Style</option><option value="Jazz">Jazz</option><option value="Rock">Rock</option></select>';

            // Restaurants
            var restaurant = '<div id="type_text">Type</div><img src="app/search/images/arrow.gif" id="arrow" /><select name="restaurant_type" id="type"><option value="Japanese">Japanese</option><option value="Mexican">Mexican</option></select>';

            if($(this).val() == 'Any Category') {
                $('#type_holder').html(any_category);
                }

            if($(this).val() == 'music_page') {
                $('#type_holder').html(music);
                }
            if($(this).val() == 'restaurant_page') {
                $('#type_holder').html(restaurant);
                }
            });

Here, is the change();. #type should instantiate the search on change(); But, doesn’t either because it’s made from #categories on change();. Or, because I’m using change(); twice.

                // *** START *** keyup / change (for select option)
                $('#loc, #dist, #category, #type, #search_title').bind('keyup change', // HERE, #type is ignored because it's created from #categories on change(); function() {
                    var loc = $('#loc').val();
                    var dist = $('#dist').val();
                    var category = $('#category').val();
                    var type = $('#type').val();
                    var search_title = $('#search_title').val();



                    if(loc == '' && search_title != '') {

                        $.post('http://localhost/app/search/page_type/music_spot/search.name.php', {

                                                                  category:category,
                                                                  type:type,
                                                                  search_title:search_title

                                                                  },
                            function(data) {
                                $('#front_left').html(data);
                                });

                        }



                });
        });
  • 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-26T22:18:31+00:00Added an answer on May 26, 2026 at 10:18 pm

    I think you should try the live() function. Because the live function handle the dynamically created elements but you can read more on documentation 🙂

    So you can try something like this:

    $('#loc, #dist, #category, #type, #search_title').live('keyup change', function(){
    // code here
    });
    

    Please read the manual because I see now that the .live() function is deprecated for jquery 1.7, and choose the appropiate function for your jquery version.

    I hope this resolve your problem, and sorry for my english :”>

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

Sidebar

Related Questions

I am probably trying to accomplish too much in a single query, but have
This is a very simple, probably too simple question but I'm afraid my limited
Update: This turned into a blog post, with updated links and code, over at
Update: This does work, I was being stupid :( i have the following extension
Update: This is, as I was told, no principle Python related problem, but seems
UPDATE: This question is out of date, but left for informational purposes. Original Question
Update: This question was an epic failure, but here's the working solution. It's based
This is probably a simple question, but how do you iterate through an array,
I hope this question is not considered too basic for this forum, but we'll
Probably this is a basic stuff, but better learn now then later. What i'm

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.