I have a apex:inputField where I'm getting lookup field. Now I want to get the Id of that selected record in lookup field in my javascript.
I'm able to get the record name but not record id
VF Page:
<apex:inputField id="accountName" value="{!Oppty.AccountId}" onchange="accountSelected(this.value);" />
function accountSelected(data){
console.log(' >>> Account changed... '+JSON.stringify(data));
}