--- id: bad87fee1348bd9aeda08826 title: Identificare elementi per id usando jQuery challengeType: 6 forumTopicId: 18317 required: - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' dashedName: target-elements-by-id-using-jquery --- # --description-- Puoi anche selezionare gli elementi in base ai loro attributi id. Prima identifica il tuo `button` con l'id `target3` utilizzando il selettore `$("#target3")`. Nota che, proprio come con le dichiarazioni CSS, digiti un `#` prima dell'id. Quindi usa la funzione `.addClass()` di jQuery per aggiungere le classi `animated` e `fadeOut`. Ecco come far dissolvere l'elemento `button` con l'id `target6`: ```js $("#target6").addClass("animated fadeOut"); ``` # --hints-- Dovresti selezionare l'elemento `button` con l'`id` di `target3` e usare la funzione jQuery `addClass()` per dargli la classe `animated`. ```js assert($('#target3').hasClass('animated')); ``` Dovresti selezionare l'elemento con l'id `target3` e usare la funzione jQuery `addClass()` per dargli la classe `fadeOut`. ```js assert( ($('#target3').hasClass('fadeOut') || $('#target3').hasClass('fadeout')) && code.match(/\$\(\s*.#target3.\s*\)/g) ); ``` Dovresti usare solo jQuery per aggiungere queste classi all'elemento. ```js assert(!code.match(/class.*animated/g)); ``` # --seed-- ## --seed-contents-- ```html

jQuery Playground

#left-well

#right-well

``` # --solutions-- ```html

jQuery Playground

#left-well

#right-well

```