Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

245
Views
Javascript - how to pull the correct content from an element

I am trying to run a javascript that will pull salaries off a webpage, do a calculation, then edit the webpage to show a new number (automating right click -> inspect).

I have been following a guide on how to scrape a webpage and put the desired elements into a .txt file. I have amended the code to look up salaries of jobs. However when I run node. scrapesalaries.js it pulls through the location and the salary.

Is there a way I can only pull through the salary? Code below.

var request = require('request');
var cheerio = require('cheerio');
var fs = require('fs');

request("https://www.reed.co.uk/jobs/manager-jobs", function(error, response, body) {
  if(error) {
    console.log("Error: " + error);
  }
  console.log("Status code: " + response.statusCode);

  var $ = cheerio.load(body);

  $('div.row:has(ul.job-metadata)').each(function( index ) {
    var title = $(this).find('ul.job-metadata > li').text().trim();
    var link = $(this).find('ul.job-metadata > li').attr('href');
    fs.appendFileSync('salaries.txt', title + '\n' + link + '\n');
  });

});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!