خصائص maxLength لحقل البحث Input
التعريف والاستخدام
maxLength
إعداد أو استعادة قيمة خاصية maxLength لحقل البحث.
تحدد خاصية maxLength في HTML عدد الأحرف الأعلى المسموح به في حقل البحث، والقيمة الافتراضية هي 524288.
نصيحة:لإعداد أو استعادة عرض حقل البحث (بعدد الأحرف)، استخدم خاصية size.
انظر أيضًا إلى:
دليل HTML:HTML <input> maxlength Attribute
مثال
مثال 1
الحصول على عدد الأحرف الأعلى المسموح به في حقل البحث المحدد:
var x = document.getElementById("mySearch").maxLength;
مثال 2
تغيير عدد الأحرف الأعلى المسموح به في حقل البحث:
document.getElementById("mySearch").maxLength = "8";
النحو
استعادة خاصية maxLength:
searchObject.maxLength
إعداد خاصية maxLength:
searchObject.maxLength = number
Attribute Value
Value | Description |
---|---|
number | Specifies the maximum number of characters allowed in the search field. The default value is 524288. |
Technical Details
Return Value: | Number, representing the maximum number of characters allowed in the search field. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |