<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Emposha &#187; bug</title>
	<atom:link href="http://www.emposha.com/tag/bug/feed" rel="self" type="application/rss+xml" />
	<link>http://www.emposha.com</link>
	<description>Just another stupid wordpress blog ;)</description>
	<lastBuildDate>Thu, 08 Dec 2011 13:30:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Strange Jquery 1.3 behavior</title>
		<link>http://www.emposha.com/javascript/strange-jquery-13-behavior.html</link>
		<comments>http://www.emposha.com/javascript/strange-jquery-13-behavior.html#comments</comments>
		<pubDate>Thu, 15 Jan 2009 17:16:33 +0000</pubDate>
		<dc:creator>emposha</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Jquery]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[jquery 1.3]]></category>

		<guid isPermaLink="false">http://www.emposha.com/?p=134</guid>
		<description><![CDATA[Today I worked with two elements with same ids but in different forms, and found strange jquery selector engine behavior. Actually I can undrestand that, because by w3c you cant place two elements with same ids on same page.]]></description>
			<content:encoded><![CDATA[<p>Today I worked with two elements with same ids but in different forms, and found strange jquery selector engine behavior. Actually I can undrestand that, because by w3c you cant place two elements with same ids on same page.</p>
<p><strong>Description</strong>: Two froms with element with same id in both of them, trying to use jquery selector to choose one of them like this $(&#8220;#formid #elemid&#8221;). Result will be null.</p>
<p><strong>Example</strong>:</p>
<p>HTML:</p>
<blockquote><p><code><span style="font-family: Courier New; color: black; font-size: x-small;"><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">form</span> <span style="color: #ff0000;">id</span><span style="color: #0000ff;">="form1"</span> <span style="color: #ff0000;">method</span><span style="color: #0000ff;">="post"</span> <span style="color: #ff0000;">action</span><span style="color: #0000ff;">="/"</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="text"</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="inputtext"</span> <span style="color: #ff0000;">id</span><span style="color: #0000ff;">="text1"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="text1"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">=""</span><span style="color: #0000ff;">/&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="text"</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="inputtext"</span> <span style="color: #ff0000;">id</span><span style="color: #0000ff;">="text2"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="text2"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">=""</span><span style="color: #0000ff;">/&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="text"</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="button"</span> <span style="color: #ff0000;">id</span><span style="color: #0000ff;">="btn1"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="press me"</span><span style="color: #0000ff;">/&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">form</span><span style="color: #0000ff;">&gt;</span></span></code></p>
<p><span style="font-family: Courier New; color: black; font-size: x-small;"><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">form</span> <span style="color: #ff0000;">id</span><span style="color: #0000ff;">=&#8221;form2&#8243;</span> <span style="color: #ff0000;">method</span><span style="color: #0000ff;">=&#8221;post&#8221;</span> <span style="color: #ff0000;">action</span><span style="color: #0000ff;">=&#8221;/&#8221;</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">=&#8221;text&#8221;</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">=&#8221;inputtext&#8221;</span> <span style="color: #ff0000;">id</span><span style="color: #0000ff;">=&#8221;text1&#8243;</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">=&#8221;text1&#8243;</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">=&#8221;"</span><span style="color: #0000ff;">/&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">=&#8221;text&#8221;</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">=&#8221;inputtext&#8221;</span> <span style="color: #ff0000;">id</span><span style="color: #0000ff;">=&#8221;text2&#8243;</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">=&#8221;text3&#8243;</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">=&#8221;"</span><span style="color: #0000ff;">/&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">=&#8221;text&#8221;</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">=&#8221;button&#8221;</span> <span style="color: #ff0000;">id</span><span style="color: #0000ff;">=&#8221;btn2&#8243;</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">=&#8221;press me2&#8243;</span><span style="color: #0000ff;">/&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">form</span><span style="color: #0000ff;">&gt;</span><br />
</span><br />
<span style="color: gray; font-size: xx-small;">* This source code was highlighted with <a href="http://virtser.net/blog/post/source-code-highlighter.aspx"><span style="color: gray; font-size: xx-small;">Source Code Highlighter</span></a>.</span></p></blockquote>
<p>Javascript:</p>
<blockquote><p><code><span style="font-family: Courier New; color: black; font-size: x-small;">$(<span style="color: #a31515;">'#btn1'</span>).click(<span style="color: #0000ff;">function</span>() {<br />
<span style="color: #0000ff;">if</span> (!$(<span style="color: #a31515;">'#form1 #text1'</span>).val()) {<br />
$(<span style="color: #a31515;">'#form1 #text1'</span>).css(<span style="color: #a31515;">'border'</span>,<span style="color: #a31515;">'1px solid red'</span>);<br />
}<br />
<span style="color: #0000ff;">if</span> (!$(<span style="color: #a31515;">'#form1 #text2'</span>).val()) {<br />
$(<span style="color: #a31515;">'#form1 #text2'</span>).css(<span style="color: #a31515;">'border'</span>,<span style="color: #a31515;">'1px solid red'</span>);<br />
}<br />
});</span></code></p>
<p><span style="font-family: Courier New; color: black; font-size: x-small;">$(<span style="color: #a31515;">&#8216;#btn2&#8242;</span>).click(<span style="color: #0000ff;">function</span>() {<br />
<span style="color: #0000ff;">if</span> (!$(<span style="color: #a31515;">&#8216;#form2 #text1&#8242;</span>).val()) {<br />
$(<span style="color: #a31515;">&#8216;#form2 #text1&#8242;</span>).css(<span style="color: #a31515;">&#8216;border&#8217;</span>,<span style="color: #a31515;">&#8217;1px solid red&#8217;</span>);<br />
}<br />
<span style="color: #0000ff;">if</span> (!$(<span style="color: #a31515;">&#8216;#form2 #text2&#8242;</span>).val()) {<br />
$(<span style="color: #a31515;">&#8216;#form2 #text4&#8242;</span>).css(<span style="color: #a31515;">&#8216;border&#8217;</span>,<span style="color: #a31515;">&#8217;1px solid red&#8217;</span>);<br />
}<br />
});</span></p>
<p><span style="color: gray; font-size: xx-small;">* This source code was highlighted with <a href="http://virtser.net/blog/post/source-code-highlighter.aspx"><span style="color: gray; font-size: xx-small;">Source Code Highlighter</span></a>.</span></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.emposha.com/javascript/strange-jquery-13-behavior.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

