<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[[个人原创]使用Jquery的鲜活绑定(lively-ness)，解决“新添加的元素，事件不可用”的问题]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Mon, 10 Oct 2011 10:56:49 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	要求：当点击+按钮时，添加一个File位置，上传控件，当想删除这个上传文件控件时，点-取消。<br/>问题：原有DOM上的三个上传文件框可以绑定上删除一个的事件，但是，通过AddInput.click生成的就没有。<br/>如下：<br/><textarea name="code" class="html" rows="15" cols="100">
$(&quot;.del_line&quot;).click(function() &#123;
&nbsp;&nbsp;&nbsp;&nbsp;alert(&quot;del_line&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;$(this).parent().remove();
&nbsp;&nbsp;&nbsp;&nbsp;--file_id;
&nbsp;&nbsp;&#125;);
</textarea><br/><br/>解决：使用Jquery的Live Query插件，删除新加的文件控件的JS代码改为，livequery这个加上：<br/>&lt;script type=&quot;text/javascript&quot; src=&quot;/js/jquery/jquery.livequery.js&quot;&gt;&lt;/script&gt;<br/><textarea name="code" class="html" rows="15" cols="100">
&nbsp;&nbsp;$(&#039;.del_line&#039;).livequery(&#039;click&#039;, function(event) &#123; &nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;alert(&quot;del_line&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;$(this).parent().remove();
&nbsp;&nbsp;&nbsp;&nbsp;--file_id;
&#125;);
</textarea><br/>参考来源：<br/>使用Jquery的鲜活绑定(lively-ness)，解决“新添加的元素，事件不可用”的问题：<br/>http://www.cnblogs.com/yongzhi/archive/2008/11/27/1342096.html<br/><br/><br/>附录如下：<br/>添加新上传文件Js事件：<br/><textarea name="code" class="html" rows="15" cols="100">
&nbsp;&nbsp;$(&quot;.dodiv&quot;).click(function()&#123;
&nbsp;&nbsp;&nbsp;&nbsp;var file_up = &#039;&lt;div style=&quot;margin-top: 4px;&quot; class=&quot;uploadinput&quot;&gt;&#039; +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#039;&lt;img src=&quot;/image/error.png&quot; style=&quot;width: 18px; height: 18px; display: none&quot;&gt;&lt;/img&gt;&#039; +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#039;&lt;input type=&quot;file&quot; class=&quot;inputnormal&quot; style=&quot;height: 20px; width: 180px;&quot; name=&quot;upload-local-&#039; + file_id + &#039;&quot; /&gt; &#039; +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#039;&lt;input type=&quot;text&quot; class=&quot;inputnormal&quot; /&gt; &lt;input type=&quot;checkbox&quot; /&gt;新文件&#039; +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#039;&lt;img class = &quot;del_line&quot; src=&quot;/image/badge-circle-minus.png&quot; style=&quot;width: 18px; height: 18px&quot;&gt;&lt;/img&gt;&lt;/div&gt;&#039;;
&nbsp;&nbsp;&nbsp;&nbsp;++file_id;
&nbsp;&nbsp;&nbsp;&nbsp;//alert(file_id + &quot; &quot; + file_up);
&nbsp;&nbsp;&nbsp;&nbsp;$(&quot;#soft-file&quot;).append(file_up);
&nbsp;&nbsp;&#125;);
</textarea><br/><br/>
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [个人原创]使用Jquery的鲜活绑定(lively-ness)，解决“新添加的元素，事件不可用”的问题]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>