Sign in to follow this  
Vans

document.querySelector()

Recommended Posts

Доброго времени суток господа!
Столкнулся с такой проблемой:
 

Quote

<div class="main">
    <h1>Hello World!</h1>
  </div>

Quote

var div = document.querySelector('.main > h1')
console.log(div)

Возвращает null

Share this post


Link to post
Share on other sites
1 час назад, Vans сказал:

Возвращает null

Возвращает "<h1>Hello World!</h1>". Проверьте подключение скрипта, он у вас срабатывает раньше чем построится DOM

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Member Statistics

    46,439
    Total Members
    3,128
    Most Online
    Talomir
    Newest Member
    Talomir
    Joined
  • Recently Browsing   0 members

    No registered users viewing this page.