I have the next select on the view:
<div class="sort">
<label for="sort"><span>Sort by:</span></label>
<select name="sort" id="sort">
<option selected="selected" disabled="disabled" style="display:none;">Choose...</option>
<option
<c:if test="${pagination.sortOn eq 'time' and pagination.asc}">selected="selected"</c:if>
data-text="DESC" value="time"
data-order="asc">
DESC
</option>
<option
<c:if test="${pagination.sortOn eq 'time' and not pagination.asc}">selected="selected"</c:if>
data-text="ASC" />" value="time"
data-order="desc">
ASC
</option>
</select>
</div>
This is how I place JQuery widget on this select:
$('#sort').goodsListSelect({
width : 180,
appendTo : ".sort",
change : function() {
var option = $(this).find(":selected:not([disabled])");
if (option.val()) {
utils.reloadWithParams({
"page" : 1,
"sort" : option.val(),
"order" : option.attr("data-order")
});
}
}
});
The problem is I cant get working the first option "Choose...". It should be displaying only if user not choosen any other option.
I've tried the following answers, but they are not working for me:
How such behavior may be achieved ?