'Hide custom field depending on the page

I need to hide a custom field created by a theme only in a specific page.

I am using a code that works perfect in another site but in wordpress seems to not working and i can't spot why not. The code loads as far as i can see in source page. I have added the code directly into the theme header.php file and this is the code

<script type="text/javascript">
    $(document).ready(function() {
        if (window.location.href.indexOf("https://www.demosite.com/advanced-search/?adv_location=&bedrooms=&bathrooms=&filter_search_type%5B%5D=residential-land&filter_search_action%5B%5D=&price_low=0&price_max=9900000&submit=Search&elementor_form_id=18618") ){
            $('#property-size-ft2').hide();
        }
    });
</script> 

Ideal case would be to have the ability to create a custom advanced search per each page but this is not possible, that is why i created all the custom fields and now i want to fine some of them, depending on he actual page they are displayed.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source