fbpx

How to use jQuery selectors ?

631 views October 5, 2016 July 13, 2019 admin 3

jQuery selectors in wpsolr are used to associate live suggestions and geolocation to your theme’s search box(es).

When the wpsolr javascript code needs to identify your search box(es), to attach specific events, it does so by using jQuery selectors.

What is jQuery ?

jQuery is a javascript library, widely used to simplify the manipulation of the elements of a HTML page, the Document Object Model (DOM).

What are jQuery selectors ?

They are a way for a javascript code to identify a HTML element, or several HTML elements. It can be an id, a class, a name, a descendant, an ascendant. There are many ways to identify HTML elements in the Document Object Model (DOM).

See examples from w3schools

How do I find my selectors ?

In your browser, hover the search box for which you want to retrieve a selector from, then right click to open the browser inspector. It will show you the HTML code of your search box.

If the HTML code contains

id="myId"

then your jQuery selector could be

#myId

 

If the HTML code contains

class="myclass"

then your jQuery selector could be

.myclass

 

 

Was this helpful?

Leave A Comment
*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Join Our weekly Newsletter

Receive our latest news once a week, each Thursday afternoon.
Your email is kept 100% private, and you will not receive other stuff in your mailbox.

We keep your data private and share your data only with third parties that make this service possible. Read our Privacy Policy.