I need to rewrite the display: none !important;
for display: block;
with javascript
I'm using this code below, but it has only worked on mobile browsers
document.getElementById('billing_state_field').style.setProperty("display", "block", "important");
For some reason in Google Chrome and Firefox the style has not changed
This is the page I'm trying to change. https://vegazcomm.com/finalizar-compra/
(You may need to add an item to the cart and click buy to reach the page)
The idea of the code is to make the address fields appear only after the user touches the Post Code input
To make the fields disappear I had to use display: none! Important;
on css and overwrite with JS.
The complete code is here
<script>
window.onload = function(){
document.getElementById('billing_postcode').onclick = function(){
//console.log('Hello world');
document.getElementById('billing_address_1_field').style.setProperty("display", "block", "important");
document.getElementById('billing_address_2_field').style.setProperty("display", "block", "important");
document.getElementById('billing_billing_number_field').style.setProperty("display", "block", "important");
document.getElementById('billing_city_field').style.setProperty("display", "block", "important");
document.getElementById('billing_state_field').style.setProperty("display", "block", "important");
}
}
</script>