SO jQuery Fiddle

Test Fiddle mainly for SO Questions jQuery 1.4.3, UI 1.8.5

by Nick Craver

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/ui-lightness/jquery-ui.css">
<select class="selecturl">
 <optgroup label="Fruit">

  <option value="/something/167/remote">Apple</option>

  <option selected="" value="/something/168/remote">Oranges</option>

  <option value="/something/169/remote">Bananas</option>

  <option value="/something/170/remote">Carots</option>

 </optgroup>
</select>

JavaScript

$('.selecturl').change(function() {
  console.log($(this).val()); //gets the value
  console.log($(this).find(':selected').text()); //gets the text
});