If you want to use jQuery selectors on the server to parse a bunch of HTML, I would recommend you to check out cheerio.


$ npm install cheerio


Given the following HTML:

<ol class="breadcrumb">
<li><a href="/home">Home</a></li>
<li><a href="/library">Library</a></li>
<li><a href="/data" class="active">Data</a></li>
var cheerio = require('cheerio');
var $ = cheerio.load(htmlString);

$('ol .active').text(); // 'Data'
$('[href]').each(function getLink() {
var attr = $(this).attr('href');
// Do something with the link

Get the ol class

$('ol').attr('class'); // 'breadcrumb'

Check our more examples in [the documentation](https://github.com/cheeriojs/cheerio)