cheerio


how to extract info in this kind of html using cheerio?


I got a html as follow, also the code to extract two info, namely: Info123 and '123, abc', $(el).children('span').text() returns 'Info123', but how to extract '123, abc'? thanks
"use strict";
let s = `
<div class="info">
<SPAN title="inf">Info123</SPAN> 123, abc
</div>
`
var cheerio = require('cheerio'),
$ = cheerio.load(s);
$('.info').each(function(i, el) {
console.log($(el).children('span').text()) // get Info123
console.log($(el).text()) // get Info123 123, abc
})

Related Links

confused about cheerio nextUntil
Get the text of the current node only
Accessing the text of a class that contains other elements using Cheerio
cheerio reading children of script tag
how to extract info in this kind of html using cheerio?
Cheerio not finding table content

Categories

HOME
turing-machines
redux-form
pyqt
nuget-package
computer-science
qpython
okhttp
little-proxy
owin
project-intu
line
gource
alpacajs
smartclient
delphi-xe5
solrcloud
replication
selinux
user-experience
visual-glitch
mount
wcag
spotipy
user-defined-functions
gp
realm-mobile-platform
sqsh
google-cast
dumpbin
fossil
apiary.io
salesforce-communities
typesafe-config
laravel-elixir
android-softkeyboard
wmp
sharp-snmp
ssrs-2014
clang++
memory-mapping
oim
servermanager
google-cse
compiler-design
skin
cvxpy
mapxtreme
omxplayer
custom-lists
model-associations
dimension
refinerycms
tracker-enabled-dbcontext
redis-cluster
false-sharing
httpruntime.cache
piracy-prevention
phpgrid
crouton-os
highland.js
django-urls
toolkit
eoferror
typemock
wso2greg
sha512
nutiteq
rapidsvn
iso-prolog
cbind
functional-java
gnumeric
gae-quotas
android-audiorecord
eclipse-kepler
jammer
kendo-dataviz
breakout
isqlquery
ice-cube
inappsettingskit
mongohq
poker
superscrollorama
twisted.web
alice
pstack
google-maps-mobile
screen-size
winmain
load-time
office-2007
interop-domino
alsb
scrubyt
entitykey
wcf-proxy

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App