Jump to content

Recommended Posts

I am using the JQuery UI slider widget (http://jqueryui.com/demos/slider/) and I'm trying to have each option in the select dropdown be a different URL. 

 

When I slide the slider, nothing happens.  But if I choose one of the options from the corrseponding dropdown menu, the page goes to the URL.

 

My code is below. Basically, the onchange functionl is only happening if I change the select dropdown menu "the standard way".  If you use the JQuery slider, it doesn't do it.

 

Any ideas how to make my "onchange" function happen when the slider is moved?  I see some info on the site about a "Change" event, which I'm guessing might be what I have to do, but I am not sure how to implement it properly (I'm very new to JQuery).

 

Anyone?

 

	$(function() {
	var select = $( "#cluewidthpicker" );
	var slider = $( "<div id='slider'></div>" ).insertAfter( select ).slider({
		min: 1,
		max: 9,
		range: "min",
		value: select[ 0 ].selectedIndex + 1,
		slide: function( event, ui ) {
			select[ 0 ].selectedIndex = ui.value - 1;
		}
	});
	$( "#cluewidthpicker" ).change(function() {
		slider.slider( "value", this.selectedIndex + 1 );
	});

});

Clue Width:
<select name='cwidth' id='cluewidthpicker' onchange='location = this.options[this.selectedIndex].value;'>
<option value='changecwidth.php?id=<?php echo $id;?>&rat=10' <?php echo $cselect1; ?>>10</option>
<option value='changecwidth.php?id=<?php echo $id;?>&rat=20' <?php echo $cselect2; ?>>20</option>
<option value='changecwidth.php?id=<?php echo $id;?>&rat=30' <?php echo $cselect3; ?>>30</option>
<option value='changecwidth.php?id=<?php echo $id;?>&rat=40' <?php echo $cselect4; ?>>40</option>
<option value='changecwidth.php?id=<?php echo $id;?>&rat=50' <?php echo $cselect5; ?>>50</option>
<option value='changecwidth.php?id=<?php echo $id;?>&rat=60' <?php echo $cselect6; ?>>60</option>
<option value='changecwidth.php?id=<?php echo $id;?>&rat=70' <?php echo $cselect7; ?>>70</option>
<option value='changecwidth.php?id=<?php echo $id;?>&rat=80' <?php echo $cselect8; ?>>80</option>
<option value='changecwidth.php?id=<?php echo $id;?>&rat=90' <?php echo $cselect9; ?>>90</option>
</select>

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.