Click here to Skip to main content
15,885,004 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted

1 solution

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
 
Share this answer
 
Comments
UshaCbe 6-Apr-13 1:13am    
Thank you for your reply
What is the name 'textBoxClassName' you mentioned is, it is textbox name or css class name. If i
it is textbox name, I have to given all the textboxes.
AmitGajjar 6-Apr-13 1:15am    
you can use $('input[type="text"]') as well to apply maxlength to all textbox.
UshaCbe 6-Apr-13 1:17am    
Thank you Very much. It is working fine. I put the css class name that works fine.
AmitGajjar 6-Apr-13 1:18am    
Great...
UshaCbe 6-Apr-13 1:26am    
Ya, that is also working fine. Once again thank u...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900