Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-31-2012, 09:49 PM   PM User | #1
probi
New Coder

 
Join Date: May 2012
Posts: 17
Thanks: 3
Thanked 1 Time in 1 Post
probi is an unknown quantity at this point
Drop down not working

Hi all,

I'm trying to get a page to update the URL based on what gets selected in a drop down menu.

In the head I have the following:

Code:
     $(document).ready(function(){
		$(".monthselect").change(function(){
			var selected;
			selected = $(document.getElementById("monthselect").value);
			window.location = "?mon=" + selected;
		});
	 });
The select box is called monthselect but when I change the drop down nothing happens.

Thanks in advance
probi is offline   Reply With Quote
Old 05-31-2012, 10:43 PM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,530
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Are you certain that you have

<select class="monthselect" ...

in the HTML?
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 05-31-2012, 10:53 PM   PM User | #3
probi
New Coder

 
Join Date: May 2012
Posts: 17
Thanks: 3
Thanked 1 Time in 1 Post
probi is an unknown quantity at this point
I was missing a " which was why it wasn't doing anything!!

Problem I have not is it is making the URL calendar.php?mon=[object%20Object]
instead of putting the value across.

Any ideas as this is really frustrating me now.
probi is offline   Reply With Quote
Old 05-31-2012, 10:56 PM   PM User | #4
probi
New Coder

 
Join Date: May 2012
Posts: 17
Thanks: 3
Thanked 1 Time in 1 Post
probi is an unknown quantity at this point
I've finally managed to sort it!

Thanks anyway.
probi is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:59 PM.


Advertisement
Log in to turn off these ads.