input只读属性

 
有两种方式可以实现input的只读效果:disabled 和 readonly。
自然两种出来的效果都是只能读取不能编辑,可是两者有很大不同。
Disabled说明该input无效,及其value不会传递给任何程序,比如asp、php等。
Readonly仅仅是无法编辑,不影响其值的传递。
Disabled使用:<INPUT type=”text” name=”username” value=”james”disabled>
Readonly使用:<INPUT type=”text” name=”partNumber” value=”1500″ readonly>

 

disabled方式若要传值,

 第一种方法:

可以添加隐藏的input标签 <input name="hiddenplanyear"  /> 

 第二种方法:

    <input type="text" class="input4" />                    

在保存的方法里

$("#mainChkUserName").attr("disabled",false);

解除无效就行。

相关文章:

  • 2022-12-23
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2021-05-06
  • 2022-02-10
猜你喜欢
  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2022-03-13
相关资源
相似解决方案