如何一次将maxlength设置为项目中的所有文本框 [英] How to set maxlength to all the textboxes in my project at a time

查看:58
本文介绍了如何一次将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设置为项目中的所有文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆