Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jQuery Event Basics / Extending Events to New Page Elements code incorrect #584

Closed
rhumborl opened this issue Dec 16, 2014 · 2 comments
Closed

Comments

@rhumborl
Copy link

// Now create a new button element with the alert class. This button
// was created after the click listeners were applied above, so it
// will not have the same click behavior as its peers
$( "button" ).addClass( "alert" ).appendTo( document.body );

This is a selector to access the existing buttons, not creating a new element. Code should pass HTML:

$( "<button>" ).addClass( "alert" ).appendTo( document.body );
@arthurvr
Copy link
Member

Indeed. The example is totally broken because of that. Testcase: http://jsfiddle.net/3wu574u4/1/

I wil open a PR with a fix.

Update: opened #587

@RedWolves
Copy link
Member

Landed in #587

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants