I need to find the object next to the select. These objects are created dynamically so I need to return the type of element. In the example a Label is next to the selects but it could be an input, img, etc. The turning off slider event works fine, but I can’t nail down the selector.
I have tried:
$( "#popupPadded" ).bind({
popupafterclose: function (event, ui) {
$(".flip_mini").val('off').slider('refresh');
var $label = $(this).next();
alert($label.text());
}
});
Here is the ul…
<ul data-role="listview" data-inset="true" >
<li>
<select class="flip_mini" id="flip-mini" data-role="slider" data-mini="true">
<option value="off">close</option>
<option value="on">open</option>
</select>
<label>First:</label>
</li>
<li>
<select class="flip_mini" data-role="slider" data-mini="true">
<option value="off">close</option>
<option value="on">open</option>
</select>
<label>Last:</label>
</li>
</ul>
Labelisnextto theselect with class flip_miniso use it instead of using $(this) which has the object on which method is called.Live Demo
As you have two select so you can get the one you require using index like this
Live Demo