JavaScript querySelector function example

If you can safely abandon IE 7, or your JavaScript's aren't of dire importance to the functioning of your site - you just might be able to abandon jQuery.

JavaScript's querySelector() method is available to you on all browsers, include IE 8+.
document.querySelector('#nav li a').setAttribute('target', '_blank');
Posted by
Snippet Viewed 1387 times.

Share your JavaScript code snippets:

  • Get some recognition & link back to your site.

 

Submit | Browse

Most Recent javascript snippets

Most Viewed