Parcourir la source

set maxlength on search when maximumInputLength is defined. closes #538

Igor Vaynberg il y a 12 ans
Parent
commit
4e1873fb9d
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  1. 4 0
      select2.js

+ 4 - 0
select2.js

@@ -724,6 +724,10 @@ the specific language governing permissions and limitations under the Apache Lic
                 this.monitorSource();
             }
 
+            if (opts.maximumInputLength !== null) {
+                this.search.attr("maxlength", opts.maximumInputLength);
+            }
+
             var disabled = opts.element.prop("disabled");
             if (disabled === undefined) disabled = false;
             this.enable(!disabled);