I have a packaged app - whose snippet is below and the form that displays shows ascending date (ascendingSort) and Title as the default items - I'd like to show the Publication Date (availableDate) and the descending date (descendingSort) as the two defaults - how in either Jquery or JavaScript can this be obtained - since this is a packaged app - I have to adjust this code via a secondary function:

<span class="toggleButton modalButtons ascendingSort descendingSort" data-bind="click: $root.sort"></span>
<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>
<option value="author">Author</option>
<option value="availableDate">Publication Date</option>
<option value="name">Title</option>
<option value="viewCount">Viewed</option>
Re: Using JQuery or JavaScript to Obtain Default Behavior in a Form 80 80

Well for one thing, your second SELECT is missing the opening tag around the options.

I'm not exactly sure what you're asking. If you're wanting to just change the default selected option, just add the selected attribute to the option tag.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.