JQuery Hiding/Disabling element is not working on all the pages

143
December 14, 2019, at 5:30 PM

I have a strange behaviour (or I'm probably still newbie) on changing elements with JQuery.

I have a woocommerce form with the option for the user to select from a dropdown box a value to pickup a product. I could set up a default value and I pretend to lock that value to the user, i.e., display that information but disable the option to change the value on the dropdown.

Initially it was like this:

I could change with JQuery 3 elements, namely hiding the label above the dropdown, hiding the arrow of the dropdown and disabling the dropdown, and it was working properly on that same page (cart form):

after my changes

When on this form I click on the "Finalize the Purchase" button and the site moves to the page checkout, the same 3 elements are reverting back to its initial state (without my changes):

checkout page

Here's what I'm doing in JQuery:

$(document).ready( function(){
$('.select2-selection__arrow').removeClass('select2-selection__arrow');         
$('.pickup-location-current-lookup-area').hide();       
$('select[name="_shipping_method_pickup_location_id[0]"]').prop('disabled',true); })

Here's how to reproduce the issue example use diogo.mj.ferreira+perigo4@gmail.com as user and diogoferreira4 as password.

What I'm doing wrong? How can I change these 3 elements on both pages (cart and checkout)?

Thanks for helping.

Rent Charter Buses Company
READ ALSO
How can i create split text into multiple column animation when scrolling using javascript?

How can i create split text into multiple column animation when scrolling using javascript?

I want to create a text split animation like this website https://wwwdanielspatzek

117
Add new datas into existing scope-angularjs

Add new datas into existing scope-angularjs

I have started to learn angularjs, I am trying to insert new values on button click with existing scopeI have one button in my page,whenever I click that button $scope

113
Get metadata from linkedin Sales Navigator

Get metadata from linkedin Sales Navigator

Trying to get the network response(only metadata) from linked Sales Navigator Search by using the [code] selector

86