CSS - incorrect using of Selectors?

2019-08-07 01:39发布

问题:

This is the code I have right now with jQuery. 1.fiddle. What I want is to create the same scenario without jQuery. This is where I ended up. 2. fiddle.
Can anyone point out what I have done wrong here?? (As far as I can think of, my problem is with the CSS Selectors)

Thank you.

回答1:

The is no .hide() method in HTML. To hide an element, set the display style to none.

setTimeout(function()
{
    document.getElementById("blocker").style.display = "none";
}, 3000);

Also, the original CSS can work without jQuery.



回答2:

Try below. Don't use hide() in native javascript.

setTimeout(function()
{
    document.getElementById("blockid").style.display = "none";
}, 1000);


回答3:

There is no function hide() in native javascript. Replace the hide() function with following line.

    document.getElementById("blocker").style.display = 'none';