prompt The parameters of are also complemented forward .options It can not only support passing in basic parameters , You can also pass in prompt Special properties . Of course , Or not .yes carry value Form value index Indexes elem Form Elements
- //prompt The new custom members of the layer are as follows
- {
- formType: 1, // Type of input box , Support 0( Text ) Default 1( password )2( Multiline text )
- value: '', // The initial value is , Default empty character
- maxlength: 140, // Maximum length of text that can be entered , Default 500
- }
- // Example 1
- layer.prompt(function(value, index, elem){
- alert(value); // obtain value
- layer.close(index);
- });
- // Example 2
- layer.prompt({
- formType: 2,
- value: ' Initial value ',
- title: ' Please enter the value ',
- area: ['800px', '350px'] // Custom text field width and height
- }, function(value, index, elem){
- alert(value); // obtain value
- layer.close(index);
- });
layer.prompt({
formType: 2,
value: ' Initial value ',
title: ' Please enter the value ',
area: ['800px', '350px'] // Custom text field width and height
}, function(value, index, elem){
console.log(elem[0].value); // obtain value
layer.close(index);
});
Learning style :
console.log(elem);
console.log(elem[0]);
console.log(elem[0].value);
console.log(elem[0].style)
console.log(elem[0].type); ;