From:  Dan Scott <>
Date:  08 May 2017 21:29:54 Hong Kong Time

Re: Why this jQuery not working?


Ah, fired up the Firefox Dev Tools and debugged what's happening.

When you click the button, the click handler is firing for both the button
and the body element. First the click handler you registered on the button
fires ("hide button"); then the click handler on the body fires ("show
button"), effectively resulting in no change. jQuery seems to propagate the
event up to body and to have it run last, whereas if you wrap the button in
a div and register a click handler on the div, a click on the button
doesn't propagate to the div. Weird.

I would suggest creating a sibling element to the button, such as "
Or click me
" and register that as the click handler to show the button. Also I'm not sure if this mailing list is the right forum for these kinds of questions; is this related to a specific section of an MDN tutorial? On Mon, May 8, 2017 at 8:59 AM, M A wrote: > Not working.. Tried both... Giving both button hide and button show > together does not hide also... > > On May 8, 2017 8:46 PM, "Dan Scott" wrote: > >> Could be that body, with nothing to show, collapses to an effective >> height of 0 pixels. Try adding another element to the body so that it has >> an implicit height and there will be some obvious target within it to click >> on, or style the body so it has an explicit height dimension. >> >> On Mon, May 8, 2017, 08:27 M A wrote: >> >>> Still not working >>> >>> On May 8, 2017 20:17, "Dan Scott" wrote: >>> >>>> Try changing to The body element is already >>>> displayed, it's the button that has been hidden. >>>> >>>> On Mon, May 8, 2017, 08:12 M A wrote: >>>> >>>>> >>>>> >>>>> >>>>> Jquery Test >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> It only hides when clicked but does not show when body clickedd! >>>>> ____________________________________________________________ >>>>> _____________ >>>>> Discussing Developer documentation on MDN: dev-mdc mailing list >>>>> List email: >>>>> Manage your membership: >>>>> Unsubscribe: >>>>> ons/dev-mdc/ >>>>> MDN contributor guide: >>>>> >>>>