Jake
Jake

Reputation: 3486

why isn't jquery executing once page loaded?

I have this code to run once the page has loaded on the class unseen however its not working. It doesn't execute.

When i copy and paste it into my browser with the "javascript:" part at the start it works perfectly, what's going wrong?

I hope someone can help

$(function() {
      setTimeout(function() {  $('.unseen').css('border','2px solid #ffffff'); }, 600);        
 });

Thanks lots

Jake

Upvotes: 0

Views: 60

Answers (1)

Raynos
Raynos

Reputation: 169373

Example

Works for me. You realise #ffffff is white, right?

Fun fact: You don't need jQuery

var forEach = Array.prototype.forEach;

window.addEventListener('DOMContentLoaded', function() {
    setTimeout(function() {
        forEach.call(document.querySelectorAll('.unseen'), function(v) {
            v.style.border = '2px solid black';
        });
    }, 600);
}, false);

Upvotes: 1

Related Questions