This is my html:
<select id="my-select">
<option value="1100">First option</option>
<option value="1200">First option</option>
<option value="1300">First option</option>
</select>
I am trying out scraperjs library to parse HTML. In their github page, there is this example:
var scraperjs = require('scraperjs');
scraperjs.StaticScraper.create('https://news.ycombinator.com/')
.scrape(function($) {
return $(".title a").map(function() {
return $(this).text();
}).get();
})
.then(function(news) {
console.log(news);
})
Then I try the same thing on my HTML but it does not work. I only change this:
var scraperjs = require('scraperjs');
scraperjs.StaticScraper.create('https://news.ycombinator.com/')
.scrape(function($) {
return $("#my-select option").map(function() {
return $(this).attr("value");
}).get();
})
.then(function(news) {
console.log(news);
})
What is wrong with my jquery selector?