- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to add a title in anchor tag using jQuery?
To add a title in anchor tag in jQuery, use the prop() method. The prop() method is used to set properties and values of the selected elements.
You can try to run the following code to learn how to add a title in anchor tag using jQuery −
Example
<html> <head> <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#button1").click(function(){ $('.myClass').prop('title', 'This is your new title'); var myTitle = $('.myClass').prop('title'); alert(myTitle); }); }); </script> </head> <body> <div id='div1' class="myclass"> <a class="myClass" href='#'><img src='http://tutorialspoint.com/green/images/logo.png' /></a><br> <button id="button1">Get Title</button> </div> </body> </html>
- Related Articles
- How to add a class on click of anchor tag using jQuery?
- How to find anchor tag in div and add class using jQuery?
- How to add and remove a class to an anchor tag with jQuery?
- How to mark work title using cite tag in HTML?
- How to make an anchor tag refer to nothing?
- How to use title tag in HTML Page?
- How to replace innerHTML of a div tag using jQuery?
- How to get innerHTML of a div tag using jQuery?
- How to add title to regression model using stargazer in R?
- How to add a chart title in Excel?
- How to remove an attribute from each tag using jQuery?
- How to add a new row in a table using jQuery?
- How to use the tag to define HTML document title?
- How to add a title on Seaborn lmplot?
- How to add a title to JTable in Java Swing?

Advertisements