jQuery Essentials by Miles Troy
Author:Miles, Troy [Miles, Troy]
Language: eng
Format: azw3, mobi
Publisher: Packt Publishing
Published: 2016-01-30T05:00:00+00:00
This code sample is nearly identical to the previous sample, except the focus and blur events have been replaced with the focusin and focusout events, respectively. We again hook the parent fieldset element. This time, however, the events bubble up to their parent. We add the active class to the fieldset and even display which element generated the event by getting its ID from the target property of the event object.
// Adds an input tag dynamically by clicking the "Add Another" button var inputCounter = 0; $('#addAnother').click(function (event) { console.info("Adding another"); $('#inputMomma').append($("<input>").attr({'type': 'text', 'id': 'newInput' + inputCounter++})); }); // Makes the parent element the active class $('#inputMomma').focusin(function (event) { console.info('Focusin: ' + this.id + ', triggered by: ' + event.target.id); $(this).addClass('active'); }); // Removes the active class from the parent $('#inputMomma').focusout(function (event) { console.info('FocusOut: ' + this.id + ', triggered by: ' + event.target.id); $(this).removeClass('active'); });
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9931)
The Mikado Method by Ola Ellnestam Daniel Brolund(9799)
Dependency Injection in .NET by Mark Seemann(9356)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7799)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7575)
Svelte with Test-Driven Development by Daniel Irvine(7345)
Test-Driven Development with PHP 8 by Rainier Sarabia(7087)
Layered Design for Ruby on Rails Applications by Dementyev Vladimir;(6937)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(6544)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6432)
Web Development with Django by Ben Shaw Saurabh Badhwar(6402)
React Application Architecture for Production by Alan Alickovic(6126)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5822)
Kotlin in Action by Dmitry Jemerov(5080)
Audition by Ryu Murakami(4601)
Software Architecture for Web Developers by Mihaela Roxana Ghidersa(4548)
Accelerating Server-Side Development with Fastify by Manuel Spigolon Maksim Sinik & Matteo Collina(4398)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4329)
Solidity Programming Essentials by Ritesh Modi(4103)
