javascript - Extracting text between end and start of tags -


i'm looking extract telephone number:

i using nodejs / expressjs / request / cheerio.

this code part of web crawler.

<div class="info">    <h3> home </h3>    <p>      <strong> tel: </strong>      01345 000000      <strong> fax: </strong>      01345 000000    </p>    <p>    </p>

i'm able retrieve text "tel:".

here's progress i've made:

$('div.info p').filter(function() {    $(this).find('strong').filter(function() {      var phonenumber = $(this).text();      console.log(phonenumber);    });  });

this should work:

var temp = $('p');  temp = temp.text().trim();  temp = temp.substring(4, 22);    $('.info').html(temp);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>    <div class="info">    <h3> home </h3>    <p>      <strong> tel: </strong>      01346 000000      <strong> fax: </strong>      01345 000000    </p>    <p>  </p>


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -

java - How can I send the data from a imput type="file" to the controller? -