<script> var v={$menu.pid}; $("#pid option").each(function(){ if($(this).val()==v){ $(this).attr("selected", true); } }); </script>