Search code examples
jquerymobileicenium

parse html to div in icenium


i'm a new in programming jQuery. I want to parse an external html page and show it in a mobile app.

function mealSearch() {


$.get('http://www.web-page.de/page.html', function(html){
   html = $(html.replace(/<img[^>]*>/g,""));
   console.log((html));
});

I get the whole html page I want, without the pictures.

Now I want to get only the part which is in a special div?

When I add .find after the replace, I get an error: has no method find

Thanks for your help


Solution

  • Probably you are doing this -

    html = $(html.replace(/<img[^>]*>/g,"").find("div.someclass"));
    

    (you are getting that error bcoz you are trying to use .find() on string var and not on jQuery object)

    You need to do this -

    html = $(html.replace(/<img[^>]*>/g,"")).find("div.someclass");