I'm trying to access the pre-filled values during the Magento onepage checkout (index.php/checkout/onepage/). Magento pre-fills the address if you select the "Shipping Address" to be the same as the "Billing Address" but later return one step back to edit the "Shipping Address" manually.

I'm having trouble to find the pre-filled values in the entire DOM. It's not possible to access the value with JavaScript what so ever.

Here's how I'm currently trying it:


The DOM element looks like the following (no trace of the actual value):

<div class="input-field">
    <input type="text" title="Stadt" name="shipping[city]" class="input-text  required-entry" id="shipping:city" onchange="shipping.setSameAsBilling(false);">
    <label for="shipping:city" class="required">Stadt</label>

How can I actually access those values using JavaScript?


You can access the value from native javascript using el.value. See below:

  • 1
    Any specific reason you put a backslash before the :? – Kevin Goedecke Nov 28 '17 at 17:10
  • if you are using native javascript document.getelement..., you can ignore the backlash. jQuery requires backslash to get the dom element. – Ner Nov 29 '17 at 3:22

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.