0

With the following Jquery - I am trying to default the value of a select to Publication Date:

<script>
$('[name=form-control] option').filter(function() { 
    return ($(this).text() == 'Publication Date');
}).prop('selected', true); 
</script>

Here is the select code - I'm trying to default to another value:

<select class="form-control" data-bind="options: filterParams.sort , optionsText: 'name', optionsValue: 'value', value:filterParams.selectedSort , event:{ change: $root.bindPrograms}"><option value="author">Author </option><option value="availableDate">Publication Date</option><option value="name">Title </option><option value="viewCount">Viewed </option></select>

What is the best way to accomplish because the script won't set that select to the value I want.

Ideally - and also I - don't know the best way to have the sort field whose span class by default is as such to be descendingSort:

<span class="toggleButton modalButtons ascendingSort" data-bind="click: $root.sort"></span>

When I click the sort it displays the code as such:
<span class="toggleButton modalButtons ascendingSort descendingSort" data-bind="click: $root.sort"></span>

2
Contributors
1
Reply
18
Views
10 Months
Discussion Span
Last Post by vsmash
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.