1. Home
  2. Docs
  3. Developer Guide
  4. Miscellaneous and Snippet...
  5. Make Location A Mandatory Field In Search Forms

Make Location A Mandatory Field In Search Forms

add_action( 'wp_footer', 'custom_footer_script', 99 );
function custom_footer_script()
{
?>
<script>
jQuery(document).ready(function()
{
    jQuery('.property-search-form').submit(function()
    {
        if (jQuery('#address_keyword').val() == '')
        {
            alert('Please enter a location');
            return false;
        }
        return true;
    });
});
</script>
<?php
}
Was this article helpful to you? No Yes

How can we help?