Browsing all articles tagged with jquery - Share Programming Tips
Set dynamic attributes to entire site
Today while integrating theme in WordPress i have asked to my TL that is it possible to set title attribute for a tag of the HTML without actually placing it to entire site.
She has given me solution which i am sharing here,
jQuery(function () { //set dynamic title attribute to <a> tag jQuery('a').each(function() { //check broken links for the SEO if(jQuery(this).attr("href")=="#" || jQuery(this).attr("href")=="") jQuery(this).attr("href","javascript:void(0);"); if(jQuery(this).text()!='') jQuery(this).attr("title",jQuery(this).text()); }); //set dynamic title attribute for the <input type=' submit'> tag jQuery('input:submit').each(function() { if(jQuery(this).val()!='') jQuery(this).attr("title",jQuery(this).val()); }); //set dynamic title attribute for the <input type=' button'> tag jQuery('input:button').each(function() { if(jQuery(this).val()!='') jQuery(this).attr("title",jQuery(this).val()); }); }); |
Above code will set title attribute for the <a> and <input> tags.
And this way developer can place such dynamic attributes which saves lots of development and designing time.
Search in this website
our sponsors
latest comments
- shinto peter on How to configure mail from localhost ( wamp ) using PHP?
- tammylleanne on Implementation limitation of c programming language
- Deepak on How to access/unblock songs.pk in india?
- Deepak on How to access/unblock songs.pk in india?
- prk on How to access/unblock songs.pk in india?
Find us on Facebook
Top Authors
Find us on stackoverflow
Polls
Loading ...
My Bookmarks
- Audio/video Recorder & player application based on MATLAB
- check dependency of your binary
- defination of all standard c programming language function
- Great Question-Answer on c programming
- know what your c code means
- Limition of c programming language
- List of all version of c programming language
- Online c compiler
- php freelancing work
- some more stuff on C programming language
- Volatile Keyword in Embedded System
- Write Android application in c language