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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:33:02+00:00 2026-06-13T22:33:02+00:00

I have a list box and a button next to the list box. I’m

  • 0

I have a list box and a button next to the list box. I’m trying to make the page change on the list box item that’s selected. So, an item is selected then the button is pressed, which changes the page and passes the item into a search page.

At the moment, as I press a button in the List Box, it changes the page. It doesn’t wait for you to press the button. The HTML provided is here

  <div style="margin:auto">
<h3 style="text-align:center">
 Or Search By Home Town: 
 <select id="myTown">
 <?php 
   include("scripts/dbconnect.php"); 
   include("scripts/lists.php"); 
 ?>
 </select>
 <input type="button" value="Search" />
</h3>

The selector I have is here :

      $('#myTown option').click(getTown);
function getTown(){
 var town=$(this).val();
 window.location='searchresults.php?querystring='+town+'&querydesc=Town= &querytype=4';}

I think “this” should change to button or something along those lines.

or the selector “option” needs to be changed. if anyone can help that’d be great. 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-06-13T22:33:03+00:00Added an answer on June 13, 2026 at 10:33 pm

    Why don’t you just assign an event handler for the button:

    $('#button1').click(function() { getTown(); });
    
    <input id="button1" type="button" value="Search" />
    

    and then get rid of the event handler for the option tag

    update (if you can’t change html):

    $('#myTown').parent().find('input').click(function() { getTown(); });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a button defined inside of a DataTemplate for my list box. <phone:PhoneApplicationPage.Resources>
I have a list box control that contains enough items to list them with
I have the list box control (ASP.NET Control On aspx page, language C# ).
i have a list box and i want to add a folder/directory to that
I am new to MVVM . I have list box that populates the list
I have a list box that contains items that are represented by a single
I have a list box like this, <asp:ListBox ID=ListBox1 runat=server Height=175px Width=213px> <asp:ListItem Value=all>All</asp:ListItem>
I have an app that is using standard out of the box form validation
I have ListView which is customized to have a EditText box and a Button
I have a case where user can select multiple values in the list box

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.