Razor and Jquery select

Hi there

This is making me dizzy!

I am trying to use jquery so that when a user selects said value the list is sorted by that value, but my Syntax is wrong and whatever I try doesn’t work. Please help!

This is my code:

	Order by:
	<select id="myselect">
  <option value="title">Title</option>
  <option value="Last 	Updated">Last Updated</option>
  <option value="Themes">Themes</option>
  </select>
	
	
<script type="text/javascript"> 
$(document).change(function() {
  if ($("#mySelect").val() == "Title") {
	  var selection = Model.Children.OrderBy("id desc");}
	if ($("#mySelect").val() == "Title") {
	  var selection = Model.Children.OrderBy("lastUpdated");}
	

});
</script>

Thanks in advance
Natasha


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/74519-razor-and-jquery-select