Advertisement
Gecata1

Tracks changes billing_state field

Feb 27th, 2024
933
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.53 KB | None | 0 0
  1. <script>
  2. jQuery(document).ready(function($) {
  3.     // Tracks changes billing_state field
  4.     $('#billing_state').change(function() {
  5.         var selectedState = $(this).val();
  6.         // Check if the selected area is "BG-22" (for Sofia)
  7.         if (selectedState === 'BG-22') {
  8.             // Sets the value of the city field to "Sofia"
  9.             $('#billing_city').val('София');
  10.         } else {
  11.             // Otherwise, clear the city field value
  12.             $('#billing_city').val('');
  13.         }
  14.     });
  15. });
  16. </script>
Tags: woo Checkout
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement