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
xml
cobalt
linkedin
angular2-material
zend-framework
youtube-data-api-v3
interface
ado.net
interpolation
performancepoint
augeas
vimdiff
redis-sentinel
angular-dart
symmetricds
do-while
red5
jersey-1.0
smartclient
xmonad
mapstruct
swagger-2.0
boost-icl
asp.net-core-webapi
joptionpane
draft-js-plugins
froala
moses
jquery-multiselect
nstimer
8051
jaws
scrollview
mobx
quickfixj
glib
sharding
roblox
xajax
cin
azure-arm
procfile
double-click
getchar
ovf
textsum
user-defined-fields
rserve
identification
remedy
corruption
custom-font
jqchart
custom-lists
model-associations
omniauth-facebook
sklearn-pandas
concept-insights
pypiserver
canalyzer
sql-server-data-tools
nutiteq
osc
administration
paw
codeplex
vsx
vbe
square-bracket
drupal-nodes
high-resolution
sphinxql
http-patch
flex++
kaleidoscope
fragmenttransaction
wcf-configuration
dajaxice
cuda-gdb
thttpd
virtualpathprovider
entity-attribute-value
saxparseexception
winmain
pylucene
creole
strsep
load-time
delimited-text
echo3
data-mapping
silverlight-oob
tui
wordprocessingml
escrow
wysiwym
commercial-application

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