Event handler for close buttom on wordpress gallery

I have gallery on wordpress site http://thevastcreative.com/bluebird/update_theme/farm-school/ I need add event handler to close button. I need close gallery window, when i click on this button. I use jquery function but it doesn't work. Please tell me how correct write event handler for it.

Thanks

Solutions

You are facing scope issue, just don't wrap function inside ready handler callback, which is creating private scope:

{and btw, no need to rebind a new click event on same element, in your code, you are calling myclose function from inline onclick attribute}

function myclose() {
    $("#image_gallery").dialog("close");
}
Tags: Jquery / Wordpress

Similar questions

Event handler when the element has no class attached
I need an event handler that is attached to an element, that is invisible by default. In there, you can find several jQuery Tabs and the one I'm targeting is also invisible by default. Now how would I attach an event handler (.toggle() for Show/Hide), that triggers when the element does not have the hidden class (and also it's child)? My current so...
How to select and attach event handler to visual composer element using jQuery?
I have a task to generate option using ajax in visual composer element, but when I try to select the element and attach an event using jQuery.. I can't trigger the event. Below is the jQuery script that I used to select the visual composer element. This is the screenshot of the visual composer element that I want to select using jQuery. Thanks.
jquery click event handler is not called though registered
This happens in my wordpress site after upgrading to woocommerce 3.0. HTML is: In chrome dev tools, when I inspect the ol element I see it has a registered click event handler, but when I click one of the images nothing happens. Tried adding a break point at the callback beginning, did not stop there. This happens in IE, firefox and chrome so defin...
Javascript Fancybox 2 close button/link event not working
Im creating a terms and conditions popup using Fancybox 2 that shows when a user logs into our wordpress site, this content is retrieved from a div tag and uses php to find the correct content from wordpress pages. They need to click on an accept button to move on and close the popup, this link is generated within the div tag. Using a seperate php ...
[Plugin: Wordpress NextGen Gallery]Album gallery thumbnail not linking to gallery
I'm having a issue with my gallery thumbnail on the nextgen gallery album page not linking. Instead of using the given code: Located in the album-extend.php file. To be able to use a larger thumbnail, see wordpress forum question http://bit.ly/wmthxo/ I'm using the following code: The results of this can be seen at: http://fineart3/chuprinacreative...
(Plugin: Wordpress NextGen Gallery) How to show the gallery description in nextgen gallery view?
I am trying to tweak NextGen Gallery plugin, and in particular the file nextgen-gallery/view/gallery.php to achieve displaying the gallery description, when I view the gallery. So, in this file, I have added the following lines: And here is the output: The gallery description of course is not empty. There is text added, in the 'Manage Gallery"...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.