jq ajax提交表单中含有隐藏值

错误: Uncaught InvalidStateError: Failed to read the ‘selectionDirection‘ property from ‘HTMLInputElement‘: The input element‘s type (‘hidden‘) does not support selection.

 

解决方法:

   对于具有display:none样式的表单

     在提交时是以hidden的形式提交了,我有一个表单是select ,但是处于某个display:none的Div中,结果提交后JS报错:
Uncaught InvalidStateError: Failed to read the ‘selectionDirection‘ property from ‘HTMLInputElement‘: The input element‘s type (‘hidden‘) does not support selection.
display:none的表单的表单是以hidden形式提交的,我的select虽然是不显示的,但是添加了option选项,导致此问题。直接删掉该不需要显示的select表单就好了。此外,disable的表单,是不会被提交的。如果不想让某个表单可操作同时又需要提交,应该使用readonly属性,而不是disable属性。

 

即,提交的数据必须不是隐藏的

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。