JSFiddle - React, Tailwind, and code Playground

by colintoh

HTML

<div id="text-1_content"><div></div></div>

JavaScript

var yql = "http://query.yahooapis.com/v1/public/yql?q=",
    request = "select * from html where url=",
    urlRequest = "http://www.patschoolhouse.com/programmes/toddler/curriculum",
    //URL from which you want to scrape from
    xpath = "//div[@id=\"content-area\"]/div/div/div[@class=\"content\"]",
    //xpath of the element
    fullURL = yql + encodeURIComponent(request + '"' + urlRequest + '" and xpath=\'' + xpath + "'");


setTimeout(function() {
    handler1()
}, 3000);


var handler1 = function() {
    alert('fetching');
    $.get(fullURL, function(data) {
        console.log(data);
        $(data).find('.content').each(function() {
            $('#text-1_content div').html(this);
        });

        $('#text-1_content div').html($('#text-1_content div').html());
        $('#text-1_content div').css({
            "margin-bottom": "10px",
            "text-align": "left"
        });
    })
};