How can I change a class of an HTML element in response to an onclick event using JavaScript?...
Working on an idea for a simple HTMLElement wrapper I stumbled upon the following for Internet Explorer and Chrome:  For a given HTMLElement with ID in the DOM tree, it is possible to retrieve the div using its ID as the variable name. So for a di...
I've recently run into a rather nasty bug, wherein the code was loading a <select> dynamically via JavaScript.  This dynamically loaded <select> had a pre-selected value.  In IE6, we already had code to fix the selected <option&g...
I have a page where some event listeners are attached to input boxes and select boxes. Is there a way to find out which event listeners are observing a particular DOM node and for what event?  Events are attached using:   Prototype's Event.obse...
I have an HTML string representing an element: '<li>text</li>'. I'd like to append it to an element in the DOM (a ul in my case). How can I do this with Prototype or with DOM methods?  (I know i could do this easily in jQuer...
Consider the following:  <div onclick="alert('you clicked the header')" class="header">   <span onclick="alert('you clicked inside the header');">something inside the header</span> </div&...
change() function works and detects changes on form elements, but is there a way of detecting when a DOM element's content was changed?  This does not work, unless #content is a form element  $("#content").change( function(){     // do...
I'm refactoring some old JavaScript code and there's a lot of DOM manipulation going on.  var d = document; var odv = d.createElement("div"); odv.style.display = "none"; this.OuterDiv = odv;  var t = d.createElement("tab...
Can you please tell me if there is any DOM API which search for an element with given attribute name and attribute value:  Something like:  doc.findElementByAttribute("myAttribute", "aValue");...
<p data-foo="bar">   How can you do the equivalent to  document.querySelectorAll('[data-foo]')   where querySelectorAll is not available?   I need a native solution that works at least in IE7. I don’t care about IE6....

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.