The shortest possible way, without any frameworks, in all versions of Safari, FireFox, Chrome and IE >= 9:
var i = Array.prototype.indexOf.call(e.childNodes, someChildEl);
More Related Contents:
- How do I set/unset a cookie with jQuery?
- Executing elements inserted with .innerHTML
- How to stop event propagation with inline onclick attribute?
- Difference between innerText, innerHTML and value?
- getElementsByTagName() equivalent for textNodes
- document.createElement(“script”) synchronously
- Firing event on DOM attribute change
- How to expose IFrame’s DOM using jQuery?
- How To Wrap / Surround Highlighted Text With An Element
- Finding line-wraps
- Get child node index
- Getting value of HTML Checkbox from onclick/onchange events
- Check if option is selected with jQuery, if not select a default
- Select all elements with a “data-xxx” attribute without using jQuery
- DOM refresh on long running function
- Get the DOM path of the clicked
- Console shows error about Content Security policy and lots of failed GET requests
- Remove specific HTML tag with its content from javascript string
- Is it possible to programmatically catch all events on the page in the browser?
- how to compare two elements in jquery [duplicate]
- How do I wrap a text selection from window.getSelection().getRangeAt(0) with an html tag?
- forEach method of Node.childNodes?
- Getting HTML elements by their attribute names
- JavaScript: Is it better to use innerHTML or (lots of) createElement calls to add a complex div structure? [duplicate]
- Display DIV at Cursor Position in Textarea [duplicate]
- Get immediate first child element
- How can I replace one class with another on all elements, using just the DOM?
- In JavaScript, how can I replace text in an HTML page without affecting the tags?
- How do I manipulate the SVG DOM and create elements?
- Removing element with jQuery?