1

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:

document.getElementById('shipping:city').val

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>
</div>

How can I actually access those values using JavaScript?

1 Answers1

2

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

document.getElementById("shipping\:city").value
Ner
  • 1,071
  • 12
  • 28