Created
October 7, 2013 02:11
-
-
Save mgng/6861596 to your computer and use it in GitHub Desktop.
IE7:javascript経由でmaxlengthを設定しても無効になる
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="id_input"></div> | |
<script> | |
(function(){ | |
var input = document.createElement( 'input' ); | |
input.setAttribute( 'type', 'text' ); | |
input.setAttribute( 'name', 'userid' ); | |
input.setAttribute( 'maxlength', 5 ); // IE7の場合は 'maxLength' にしないとだめ | |
input.setAttribute( 'value', '' ); | |
document.getElementById( 'id_input' ).appendChild( input ); | |
})() | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment