I have an element that already has a class:  <div class="someclass">     <img ... id="image1" name="image1" /> </div>   Now I want to create a JavaScript function that will add a class to the div (not repla...
I'm just trying to do this from the chrome console on Wikipedia. I'm placing my cursor in the search bar and then trying to do document.activeElement.innerHTML += "some text" but it doesn't work. I googled around and looked at t...
Imagine:  <div id="old-parent">     <span>Foo</span>     <b>Bar</b>     Hello World </div> <div id="new-parent"></div>   What JavaScript can be written to move all the child nodes (both...
Text  changed to   <p href="page.html" class="class1 class2" id="thisid">Text</p>   I'm familiar with jQuery's replaceWith but that doesn't keep attributes/content as far as I know.    Note: Why would p...
I have a div <div id="masterdiv"> which has several child <div>s.  Example:  <div id="masterdiv">   <div id="childdiv1" />   <div id="childdiv2" />   <div id="childdiv3" /> &...
I have a angular directive which will produce bootstrap form-group, looks for $scope.errors for value of ng-model of the directive to show errors.. Example below: My html code:  <input type="text" b-input ng-model="data.company.name...
Can someone explain why the following snippet does not add <foo> to both #a and #b?  HTML:  <div id="a"></div> <div id="b"></div>   JS:  $(function(){     var $foo = $("<foo>HI</foo>")...
I have a bookmarklet which inserts a CSS stylesheet into the target DOM via a "link" tag (external stylesheet).  Recently, this stopped working on Amazon.com, in Internet Explorer only.  It works on other sites, and with other browsers (even...
As far as I have understood, querySelector returns a real changeable element while querySelectorAll returns a non-live Static Node Set.  I want to adjust the style of all elements fitting to a specific selector. It works fine for the first element wi...
I am trying to use document.evaluate() to extract certain child elements out of a <svg> element. But I have problems by just extracting the <svg> itself. I can extract everything up to the <svg>, but no further. For example this wor...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.