jQuery(document).ready(function($)
{
$('.c5sliderSelect').change(function()
{
alert('change clicked');
});
});
When I change the select list item, I get 6 alerts. Not sure why. I only have one element in the markup with this classname and the select list has 10 option items.
Any ideas why the alert fires more than once for a single change event?
Markup:
<select
class="c5sliderSelect"
title="Note: only categories which have posts assigned are listed here">
<option value="">Custom Text</option>
<option value="164">Blog (10)</option>
<option value="8">Digital Cameras (3)</option>
<option value="9">GPS Systems (1)</option>
<option value="7">Healthy Herbal Teas (1)</option>
<option value="93">hidden (1)</option>
<option value="20">iPhone 4s (2)</option>
<option value="5">Samsung Galaxy (5)</option>
<option value="4">Smart Phones (5)</option>
<option value="1">Uncategorized (7)</option>
</select>
What I’m trying to do here is to hide an unrelated div when the selected item’s value is “”
Try using something other than
alert.alerthas horrible effects on focus, and of course thechangeevent relates tofocus. Tryconsole.logor similar.For instance, this live example using your markup shows only a single
changeevent being fired.