<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: jQuery Selector Exists Examples	</title>
	<atom:link href="https://theextremewebdesigns.com/blog/jquery-selector-exists-check-if-selector-exists-in-jquery-examples/feed/" rel="self" type="application/rss+xml" />
	<link>https://theextremewebdesigns.com/blog/jquery-selector-exists-check-if-selector-exists-in-jquery-examples/</link>
	<description>Web Design and Web Development</description>
	<lastBuildDate>Fri, 17 May 2013 15:03:26 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.5</generator>
	<item>
		<title>
		By: Rocky Dev		</title>
		<link>https://theextremewebdesigns.com/blog/jquery-selector-exists-check-if-selector-exists-in-jquery-examples/#comment-178</link>

		<dc:creator><![CDATA[Rocky Dev]]></dc:creator>
		<pubDate>Fri, 17 May 2013 15:03:26 +0000</pubDate>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=874#comment-178</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://theextremewebdesigns.com/blog/jquery-selector-exists-check-if-selector-exists-in-jquery-examples/#comment-177&quot;&gt;Pman&lt;/a&gt;.

You can do this using &lt;a href=&quot;http://php.net/manual/en/class.domdocument.php&quot; title=&quot;DOMDocument&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;DOMDocument&lt;/a&gt;. But for this, you will need to load at least the part the contains the selector, in PHP. Consider following example:
&lt;code&gt;&lt;?php
$html = &#039;&lt;html&gt;&lt;body&gt;&lt;div id=&quot;my_div&quot;&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;&#039;;
$dom = new DOMDocument;
$dom-&gt;loadHTML($html);

$element1 = $dom-&gt;getElementById(&#039;my_div&#039;);
// The value of the dump will be null if tehs element is not found
var_dump($element1); //This will output: object(DOMElement)[2]


$element2 = $dom-&gt;getElementById(&#039;my_div2&#039;);
// The value of the dump will be null if tehs element is not found
var_dump($element2); //This will output: null
?&gt;&lt;/code&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://theextremewebdesigns.com/blog/jquery-selector-exists-check-if-selector-exists-in-jquery-examples/#comment-177">Pman</a>.</p>
<p>You can do this using <a href="http://php.net/manual/en/class.domdocument.php" title="DOMDocument" target="_blank" rel="nofollow">DOMDocument</a>. But for this, you will need to load at least the part the contains the selector, in PHP. Consider following example:<br />
<code><?php
$html = '<html><body></p>
<div id="my_div"></div>
<p></body></html>';<br />
$dom = new DOMDocument;<br />
$dom->loadHTML($html);</p>
<p>$element1 = $dom->getElementById('my_div');<br />
// The value of the dump will be null if tehs element is not found<br />
var_dump($element1); //This will output: object(DOMElement)[2]</p>
<p>$element2 = $dom->getElementById('my_div2');<br />
// The value of the dump will be null if tehs element is not found<br />
var_dump($element2); //This will output: null<br />
?></code></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Pman		</title>
		<link>https://theextremewebdesigns.com/blog/jquery-selector-exists-check-if-selector-exists-in-jquery-examples/#comment-177</link>

		<dc:creator><![CDATA[Pman]]></dc:creator>
		<pubDate>Thu, 16 May 2013 15:36:49 +0000</pubDate>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=874#comment-177</guid>

					<description><![CDATA[how you will do it in PHP?]]></description>
			<content:encoded><![CDATA[<p>how you will do it in PHP?</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
