Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How to select all elements with target="_blank" ?

user-image
Question ajoutée par doaa elsayed , معلم حاسب ألى , مدرسة الأنفوشى الرسمية (لغات)
Date de publication: 2017/04/13
Yew Gin Kee
par Yew Gin Kee , IT Chief , Recron (M) Sdn. Bhd.

document.querySelectorAll('.hello a') .forEach(function(element) { element.setAttribute('target', '_blank'); }) <html><body> <div class="hello"><a href="https://www.bayt.com">Bayt</a> <a href="https://www.cisco.com">Cisco</a></div></body></html>

<a href="site.com" target="_blank">go to site</a>

Md Jalal Uddin
par Md Jalal Uddin , Junior software engineer , SCOPE IT

$("a[target='_blank']").attr('target','sometarget');

shamsul hasan
par shamsul hasan , Web Developer & Administration , Al Futtaim Carillion

<a href='careers.html' target='_blank'>Careers</a>

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?