Title: How to access javascript object for custom behaviour?
Last modified: December 20, 2023

---

# How to access javascript object for custom behaviour?

 *  [frafor](https://wordpress.org/support/users/frafor/)
 * (@frafor)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/how-to-access-javascript-object-for-custom-behaviour/)
 * Hi there, I would like to add a custom behaviour after search (aka the page must
   scroll after result loaded) however I cannot attach anything to the search button
   click as your code uses unbind() and it seems it’s not possible to access the
   google.maps instance to use google.maps.event.addListener because it’s buried
   into your own function and not accessible on general scope (it’s saved as variable‘
   s’).
 * Is there any solution? Does your plugin send any js event to DOM?
    -  This topic was modified 2 years, 5 months ago by [frafor](https://wordpress.org/support/users/frafor/).
    -  This topic was modified 2 years, 5 months ago by [frafor](https://wordpress.org/support/users/frafor/).

Viewing 1 replies (of 1 total)

 *  [farroyo](https://wordpress.org/support/users/farroyob/)
 * (@farroyob)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/how-to-access-javascript-object-for-custom-behaviour/#post-17292111)
 * Hi there!
 * The easiest way to add custom behaviour after search is using the “ajaxComplete”
   event. Since all the searches are performed via AJAX, you can inject your own
   custom code on that event.
 * It could look like:
 *     ```
       jQuery(document).ready(function () {
         jQuery(document).ajaxComplete(function () {
           // your custom code here  
         });
       });
       ```
   
 * I hope that works for you. Let us know otherwise.
    Regards,

Viewing 1 replies (of 1 total)

The topic ‘How to access javascript object for custom behaviour?’ is closed to new
replies.

 * ![](https://ps.w.org/wp-store-locator/assets/icon-256x256.jpg?rev=1007784)
 * [WP Store Locator](https://wordpress.org/plugins/wp-store-locator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-store-locator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-store-locator/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-store-locator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-store-locator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-store-locator/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [farroyo](https://wordpress.org/support/users/farroyob/)
 * Last activity: [2 years, 5 months ago](https://wordpress.org/support/topic/how-to-access-javascript-object-for-custom-behaviour/#post-17292111)
 * Status: not resolved