[SalesForce] Populate Visualforce page inputfield based on picklist value

I wanted to populate an inputfield in VF page via Jquery based on a picklist value. Any inputs on how to achieve this….just missing out of syntax i believe…

<apex:inputfield value="{!Opportunity.StageName}" id="stagename" onChange="setProb()" ></apex:inputfield>
<apex:inputfield value="{!Opportunity.probability}" id="oprprob"/>

my script code is:

<apex:includescript value="{!URLFOR($Resource.jquery, 'js/jquery-1.11.3.js')}" />
<script>
function setProb(){ 
 //oprstage();
 jQuery( oprprob ).val = 10;
}
</script>

Can i refer the value picked from the list and based on it set the values for the other input field?

Best Answer

Your selector is not correct. You can use this to select the "ID Ends With"

function setProb(){ 
 jQuery( "[id$=oprprob]" ).val(10);
}