如何一次将maxlength设置为项目中的所有文本框

编程入门 行业动态 更新时间:2024-10-25 08:28:35
本文介绍了如何一次将maxlength设置为项目中的所有文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的项目已经完成,对于客户端的要求,我想设置所有文本框的maxlength,这是更改所有文本框的一个大问题。所以我使用Tagmapping来设置maxlength。这是一个长度大于给定长度的工作。例如。我将标记映射类中的最大长度设置为10。但是这可以使文本框设置为大于10,其余的文本框默认设置为0.所以那些文本框没有设置10.如何解决这个问题。

解决方案

您好, 您可以使用jQuery更新文本框的maxlength属性吗?

(document).ready(function() {

(。textBoxClassName)。attr(''maxlength'','' 10''); });

尝试上面的代码,这可能对你有用。这只是猜测,因为我还没试过。 祝你好运 -Amit

Hi, My project is finished, For the client requirement, I want to set the maxlength for all the textboxes, that is a big problem to change all the textboxes. so I m using Tagmapping for set the maxlength. It is work which one length is greater then the given length. For example. I set the max length in my tag mapping class to 10 only. But this is worked which textboxes is set to greater than 10, rest of the textboxes are defaultly set 0. So those textboxes are not set 10. How to solve this problem.

解决方案

Hi, Can you use jQuery to update maxlength attribute for your textbox ?

(document).ready(function() {

(".textBoxClassName").attr(''maxlength'',''10''); });

Try above code, that may work for you. this is just guess as i have not tried this yet. Best luck -Amit

更多推荐

如何一次将maxlength设置为项目中的所有文本框

本文发布于:2023-10-23 22:36:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1522201.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:设置为   文本框   项目   maxlength

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!