Skip to content
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
css
.gitignore
Gruntfile.js
LICENSE
README.md
bower.json
explain.html
lodash.dom-traverse.js
lodash.dom-traverse.min.js
package.json

README.md

lodash.dom-traverse

Gitter

tiny (1.28kb min, gzip) lodash extension for dom traversing (for those cases where native dom is not so easy to use):

_.$(selector, context); //get element(s)
_.$(selector, context).find(selector); //traverses down
_.$(selector, context).filter(selector); //filter by selector
_.$(selector, context).filter(function () {}); //filter with function
_.$(selector, context).siblings(); //get siblings
_.$(selector, context).next();  //get next
_.$(selector, context).prev();  //get previous
_.$(selector, context).nextAll();  //get all next
_.$(selector, context).prevAll();  //get all previous
_.$(selector, context).text(); //get text for element(s)
_.$(selector, context).text(string); //set text
_.$(selector, context).is(selector); //check if matches selector
_.$(selector, context).closest(selector); //traverses up
_.$(selector, context).css({}); //sets styles
_.$(selector, context).css(string); //returns style

easy to chain

_.$('table td').filter(_.$.simpleOdd).css({'background-color': 'rgb(0, 0, 0)'}).text()

==============

Browser support

  • IE8+
  • Modern browsers
You can’t perform that action at this time.