<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <generator>Persumi - Level up your writing and blogging with AI</generator>
  <category label="Blog" scheme="http://persumi.com/u/fredwu/tech/e/blog" term="blog"/>
  <category label="Tech" scheme="http://persumi.com/u/fredwu/tech" term="tech"/>
  <link href="http://persumi.com/u/fredwu/tech/e/blog/t/parse"/>
  <link href="http://persumi.com/u/fredwu/tech/e/blog/t/parse/feed/rss"/>
  <link rel="self" href="http://persumi.com/u/fredwu/tech/e/blog/t/parse/feed/atom"/>
  <author>
    <name>Fred Wu</name>
    <email>ifredwu@gmail.com</email>
    <uri>http://persumi.com/u/fredwu</uri>
  </author>
  <subtitle/>
  <id>http://persumi.com/u/fredwu/tech/e/blog/t/parse</id>
  <title>Blog (parse) - Fred Wu&apos;s Tech</title>
  <updated>2026-05-01T20:14:40.063046Z</updated>
  <entry>
    <content type="html">&lt;![CDATA[&lt;p&gt;
When you are getting an HTML string from an external source (e.g. from an AJAX get result) and you want to rip out a certain part of the HTML source, you need to make sure that the ‘certain part’ is not at the top level of the HTML source.&lt;/p&gt;
&lt;p&gt;
For example, we have the following HTML string:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Hello
World&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
If we want to get the first &lt;code class=&quot;inline&quot;&gt;paragraph&lt;/code&gt; element by using:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;js language-js&quot;&gt;// data is the HTML source
$(&apos;span#first&apos;, data)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
The above code won’t work, because the &lt;code class=&quot;inline&quot;&gt;p&lt;/code&gt; tags are at the top level. Instead, we can simply wrap the HTML source with a &lt;code class=&quot;inline&quot;&gt;div&lt;/code&gt; tag and that’ll do it. :)&lt;/p&gt;
]]&gt;</content>
    <published>2010-04-28T01:42:00.000000Z</published>
    <category label="Blog" scheme="http://persumi.com/u/fredwu/tech/e/blog" term="blog"/>
    <category label="Tech" scheme="http://persumi.com/u/fredwu/tech" term="tech"/>
    <link href="http://persumi.com/u/fredwu/tech/e/blog/p/jquery-tip-traverse-parse-html-string"/>
    <author>
      <name>Fred Wu</name>
      <email>ifredwu@gmail.com</email>
      <uri>http://persumi.com/u/fredwu</uri>
    </author>
    <id>http://persumi.com/u/fredwu/tech/e/blog/p/jquery-tip-traverse-parse-html-string</id>
    <title>[jQuery Tip] Traverse/Parse HTML String</title>
    <updated>2010-04-28T01:42:00.000000Z</updated>
  </entry>
</feed>