Jump to content

Get contents of a URL and show only specific text


kapz22

Recommended Posts

Hi All,

 

I am fairly new to PHP.

 

I want to write some code that will get content from specific classes that are in a HTML page.

 

I.e.

 

<p>text 1</p>

<p class="description">text2</p>

<p>text3</p>

 

I want to just output text where class = description.

 

How would i do this?

Hi

 

You can use jQuery to do that in a much easier way.

You will need the jquery library from here: http://docs.jquery.com/Downloading_jQuery#Current_Release

 

And the code:

<script type="text/javascript">

$(document).ready(function() {

var temp=$(".description").html();

alert("description is"+temp);

});

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.