<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Heck's  Blog]]></title> 
<link>https://www.heckjj.com/index.php</link> 
<description><![CDATA[一瞬间的决定，往往可以改变很多，事实上，让自己成功的往往不是知识，是精神！ 如果你总是为自己找借口，那只好让成功推迟。执行力，今天！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Heck's  Blog]]></copyright>
<item>
<link>https://www.heckjj.com/post//</link>
<title><![CDATA[为什么使用jquery 的submit()方法不能手动提交表单？]]></title> 
<author>Heck &lt;@hecks.tk&gt;</author>
<category><![CDATA[Web开发]]></category>
<pubDate>Fri, 25 Aug 2017 07:50:18 +0000</pubDate> 
<guid>https://www.heckjj.com/post//</guid> 
<description>
<![CDATA[ 
	今天有个同事遇到一个问题，就是用jquerr提交表单时出现问题，提交没反应，非要把按钮类型改成submit的才行，后来发现他的button的id写在submit，在jquery中用这些如submit, length, or method，是会产生冲突可能会导致混乱。<br/><br/> 下面是大概的代码<br/><br/>&lt;form id=&quot;fm1&quot; action=&quot;http://www.heck.tk&quot; method=&quot;post&quot;&gt;<br/>&lt;h2&gt;请输入您的用户名和密码.&lt;/h2&gt;<br/>&lt;div&gt;&lt;label for=&quot;username&quot;&gt;用户名:&lt;/label&gt; &lt;input id=&quot;username&quot; name=&quot;username&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;&lt;/div&gt;<br/>&lt;div&gt;&lt;label for=&quot;password&quot;&gt;密码:&lt;/label&gt; &lt;input id=&quot;password&quot; name=&quot;password&quot; type=&quot;password&quot; value=&quot;&quot; /&gt;&lt;/div&gt;<br/>&lt;div&gt;&lt;label for=&quot;custom&quot;&gt;自定义:&lt;/label&gt; &lt;input id=&quot;afterwardsVerify&quot; name=&quot;afterwardsVerify&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;&lt;/div&gt;<br/>&lt;div&gt;&lt;input id=&quot;warn&quot; name=&quot;warn&quot; value=&quot;true&quot; type=&quot;checkbox&quot; /&gt; &lt;label for=&quot;warn&quot;&gt;转向其他站点前提示我。&lt;/label&gt;&lt;/div&gt;<br/>&lt;div&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;input name=&quot;submit&quot; value=&quot;提交&quot; type=&quot;button&quot; onclick=&quot;attachedsign() /&gt;<br/> &lt;/div&gt;<br/>&lt;/form&gt;<br/><br/> <br/><br/>function attachedsign() <br/> {<br/>&nbsp;&nbsp;&nbsp;&nbsp;var path = &quot;/casPortal/login&quot;; <br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;$(&quot;#fm1).submit();<br/>&nbsp;&nbsp;}<br/><br/>上面代码看似没问题，但是就是提交不了。于是上jQuery API查找原因：<br/><br/>Additional Notes:<br/>Forms and their child elements should not use input names or ids that conflict with properties of a form, such as submit, length, or method. Name conflicts can cause confusing failures. For a complete list of rules and to check your markup for these problems, see DOMLint.<br/>翻译过来就是<br/><br/>其他注意事项：<br/>表单和其子元素不宜用一个表单的属性的属性作为name或id的名称，如submit, length, or method，是会产生冲突。名称冲突可能会导致混乱的失败。对于一个完整的规则列表，并检查这些问题标记。<br/><br/>于是上jquery API查找原因，看到以下这段文字顿时明白了：<br/><br/>原来就是这个name=”submit”或者id=&quot;submit&quot;的原因.........<br/>
]]>
</description>
</item><item>
<link>https://www.heckjj.com/post//#blogcomment</link>
<title><![CDATA[[评论] 为什么使用jquery 的submit()方法不能手动提交表单？]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.heckjj.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>