2018-10-12 15:37:13 -04:00
|
|
|
---
|
|
|
|
title: Target the Same Element with Multiple jQuery Selectors
|
|
|
|
---
|
|
|
|
## Target the Same Element with Multiple jQuery Selectors
|
|
|
|
|
|
|
|
## Solution
|
2019-03-02 02:03:52 +05:30
|
|
|
```html
|
2018-10-12 15:37:13 -04:00
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
$("button").addClass("animated"); // Target elements with type "button" and add the class "animated" to them.
|
|
|
|
$(".btn").addClass("shake"); // Target elements with class ".btn" and add the class "shake" to them.
|
|
|
|
$("#target1").addClass("btn-primary"); // Target elements with id "#target1" and add the class "btn-primary" to them.
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
```
|