I am working on ADA Compliance and I need to find a way to add a title tag that says, “this will open in a new window” to the social media links. Or any link that has target=”_blank for that matter but I don’t know how to get it for the social media links specifically. thanks!
Hey!
Please add following code to Functions.php file in Appearance > Editor
function av_social_target(){
?>
<script>
jQuery(window).load(function(){
jQuery('.social_bookmarks li a').attr('target','_blank');
});
</script>
<?php
}
add_action('wp_footer', 'av_social_target');
Best regards,
Yigit
That is opening in new window but does not add the title tag, I need to add the title tag that says “this will open in a new window” for ADA compliance, that is so people that are disabled are notified they are leaving when they tab over to it.
Hi!
Add also the following to the code that Yigit provided and let us know if it works
$(‘.social_bookmarks li a’).prop(‘title’, ‘this will open in a new window’);
let us know if we can do anything else
Regards,
Basilis
so what is the code supposed to be in full? When I try to add $(‘.social_bookmarks li a’).prop(‘title’, ‘this will open in a new window’); to what Yigit sent, it gives me an error.
Hi!
Please try changing the code to following one
function av_social_target(){
?>
<script>
jQuery(window).load(function(){
jQuery('.social_bookmarks li a').attr('target','_blank');
jQuery('.social_bookmarks li a').attr('title','This will open in a new window');
});
</script>
<?php
}
add_action('wp_footer', 'av_social_target');
If that too does not help, please post a screenshot and show the changes you would like to make. An example site would work too
Best regards,
Yigit