Do getElementsByClassName (and similar functions like getElementsByTagName and querySelectorAll) work the same as getElementById or do they return an array of elements?  The reason I ask is because I am trying to change the style of all elements us...
The following code:  var borderTds = document.getElementsByClassName('leftborder');   gives me an error message in Internet Explorer 6, 7 and 8:      Object does not support this method   How can I select elements by their class in these br...
HTML:  <ul id="datalist"> </ul>   JavaScript:  function add(content){    ul=document.getElementsByTagName("ul");    var li=document.createElement("li");    li.innerHTML=content;    ul.appendChild(li); }   When I ca...
I'm trying to replace all text in between tags and I want to know the fastest way of doing so.   An example would be trying to replace all text with the arbitrary string helloWorld, so that this:   <div>     <div>         RandomText1...
I'd like to be able to walk up the DOM from inside one or more nested iframes to grab and empty the parent div of the top iframe. I'd like my JS to work if there's just one iframe, or if there are two.  I have a main page with this iframe...
Let's say I have many of these in my content div : <cite class="fn">blabla</cite>  How can I check every cite tag's content (in this case: blabla) with class fn to see if it equals to "sometext" then change it'...
Please take a look at the snippet below:  <div>     <div></div>     <div><!-- my target node -->         <div><!-- not my target node -->             <img /><!-- my source node -->         </di...
I am looking to select the common parent of multiple nested elements for which I only know the inner text.  For example, in the following code:  <unknown>            <unknown class="unknown">         ....         <unknown>...
I am wondering if there is a way to select a specific element way up the DOM only using vanilla JS while not having to use parentNode multiple times. I understand you can do this with jQuery and modifying Element.prototype, but are there any other pr...
I am trying to take these functions and combine them into one.              $(".a h3").click(function() {                $(".a .collapse-this").slideToggle("slow");             });              $(".b h3").click(functio...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.