select menu

select menu

Hi All,

I have this code (below) that works well but i am having some issues with a select menu. When you select an item from the list, it adds some text to the search bar and filters the results of my listview. That works well. but when you select an option, the highlighted state doesnt change, it keeps the first option that you choose, and will never change, however, it does know what you have selected as the filtering still works, but gives the user no visual appearance to what they have choose. 

Any help anybody could give me would be appreciated.

Thanks

<div data-role="dialog" id="about" data-close-btn-text="Close This Dialog">
                <div data-role="header">
                    <h1>Filter jobs</h1>
                </div>
                    <div data-role="content">
                    <!--<h1 style="text-align: center;">About This App</h1> -->
                        <div data-role="fieldcontain" id="filterJobs">
                                <label for="selectmenu" class="select">Filter by title:</label>
                                <select name="selectmenu" id="selectmenu" data-theme="a" data-native-menu="false">
                                 <option value="" data-placeholder="true" >Please select...</option>
                                 <option value="">All</option>
                                 <option value="/VS">Veterinary Surgeon</option>
                                 <option value="/VN">Veterinary Nurse</option>
                                 <option value="/PM">Practice Manager</option>
                                 <option value="/OT">Other</option>
                                </select>
                         </div>
                    <p><a href="#home" data-role="button" data-rel="back" data-theme="a">OK</a></p>
                    </div>
       </div>

This is the js that makes the search work, and have now realised this is the problem, if i remove this, then the users choice is reflected in the dropdown menu, but i really need that code. Is there something i could change in this snippet

$(function() {
$('#selectmenu').change(function() {

var val = $(this).val();

$('.ui-input-text').val(val); //put value of select menu on search bar Filter

//alert('You selected '  + val);

function simulateKeyUp(character) { //simulate keyup to run the filter
jQuery.event.trigger({ type : 'keyup', which : character.charCodeAt(0) });
}
$('.ui-input-text').keyup();


$('body').keyup(function(e) {
jQuery.event.trigger({ type : 'keyup', which : character.charCodeAt(0) });
$('.ui-input-text').val('');

});


simulateKeyUp("e");
$('.ui-input-text').val(''); //clear filter search bar

});
});