How to set attributes of an element using jquery?
Answer / Balwant Kumar Singh
To set attributes of an element using jQuery, you can use the `attr()` method. Here is an example:
```html
<div id='myDiv'>This is the div</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
$('#myDiv').attr('title', 'New Title');
});
</script>
| Is This Answer Correct ? | 0 Yes | 0 No |
How we can select multiple elements in jquery?
What is the advantage of using protocol less URL while referencing jQuery from CDNs?
Tell me an example usage of jquery mobile? : jquery mobile
How do you check if an element is empty?
How can you disable jquery animation?
What is the use of jQuery filter?
Explain the features of jquery mobile? : jquery mobile
What does $("div") will select?
How does caching helps and how to use caching in jQuery?
What is the use of each function in jQuery?
What does dollar sign ($) me in jquery?
How you will use jquery means requirement needed for using jquery.