For instance in the snippet below – how do I access the h1 element knowing the ID of parent element (header-inner div)?
<div id='header-inner'> <div class='titlewrapper'> <h1 class='title'> Some text I want to change </h1> </div> </div>
Thanks!
Finds the element with the given ID, queries for descendants with a given tag name, returns the first one. You could also loop on
descendantsto filter by other criteria; if you start heading in that direction, i recommend you check out a pre-built library such as jQuery (will save you a good deal of time writing this stuff, it gets somewhat tricky).