When I enter mobile number in mobile field how to auto update in Phone field same Mobile number without submitting any button in page using Script/jquery

Here Mobile is Parent(Org__c Object) field. Phone is child (Employee__c Object) field.

enter image description here

  • Did you try binding the same variable to Phone and see if it works? – RedDevil Dec 4 '18 at 11:17
  • i dinnt get you RedDevil, can you please share me code or urls, thank you – SFDCLearneR Dec 4 '18 at 11:19

You can do this very easily.

I think what I would do is use jQuery and have mobile as main and then have the phone with a class.


$('#main').change(function() {

Mobile: <apex:inputText id="main"></>
Phone:  <apex:inputText class="inp"></>

You will need to add a script tags and a link to the jQuery file in your page e.g. https://code.jquery.com/jquery-3.3.1.js

  • 1
    With Visualforce elements, the ID has extra stuff in it, so you need to select the input field something like: $('input[id$=main]') when using jQuery. – sfdcfox Dec 4 '18 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.