+9 votes
334 views
asked in Programming by (10.6k points)

I have a website but most link do not have _blank attribute and I cannot edit all of these links. is it possible to achieve this problem with jQuery?

For example:

<a href="http://wikitechsolutions.com">Home</a>

<a href="http://wikiwhy.net" target="_blank">Other site</a>

<a href="index.html">Home</a>

<a href="/">Home</a>


1 Answer

+0 votes
answered by (9.7k points)

$('a[href^="http://"], a[href^="https://"]').not('a[href*=gusdecool]').attr('target','_blank');

 

 


Ask a Question
Welcome to WikiTechSolutions where you can ask questions and receive answers from other members of the community.

You can ask a question without registration.

Categories

...