How to display a custom message for no results found in an Advanced widget search, IDX Broker?

162 Views Asked by At

I am building a real estate website http://www.tampatogulfhomes.com using IDX Broker Plugin. I want to display a custom message if no results found when searched using Advanced Search Widget. For Example: Lagomar | Access Realty (http://tampatogulfhomes.com/homes-sale-hillsborough-county-tampa-mls-real-estate-listings/apollo-beach-homes-sale/lagomar/), return no result and wat to display a message to the user. Please can someone tell how can I implement this.

1

There are 1 best solutions below

4
On BEST ANSWER

You can use javascript to write to the DOM when the element id "IDX-noResultsMessage" is present. This ID only appears when there are no properties returned in a search results page.

There are online tutorials at the IDX Broker developers site

Here is a bit of sample code:

var searchResults = document.getElementById('IDX-noResultsMessage');
if(searchResults !== null)
{
document.getElementById('IDX-noResultsMessage').innerHTML='Add your custom message here';
}