简体   繁体   中英

how to insert title tag into the img tag using jquery

Below is my code to insert the title to all the img but it doesn't seem to work.

jQuery(document).ready(function() {


           $('img').attr('title','my title value');


      });

Jquery is properly working and shows all the insert and other operations but only this task i am stuck and don't know how to best accomplish it.

Are you certain its not working? Have you viewed the generated source to see the title attribute not there?

If your just testing it by hovering your mouse over the image then it may not show if you have an alt tag specified.

Also what version of jQuery are you running?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM