const buttonNumber = document.querySelector('.number');
const block = document.querySelector('.block');
let counter = 0;
buttonNumber.addEventListener('click', event => {
event.preventDefault();
const newClass = 'block';
block.classList.add(newClass+counter);
counter++;
})
localStorage.getItem('value')
const inputs = document.querySelectorAll('.input');
if( inputs.length ) {
const inputSelection = input => {
input.type = 'text';
input.setSelectionRange(0,0);
input.type = 'number';
input.blur();
}
inputs.forEach(input => {
input.addEventListener('input', event => {
if( input.value.length == input.maxLength ) inputSelection(input);
if( input.value.length > input.maxLength ) {
input.value = input.value.slice(0, input.maxLength);
inputSelection(input);
}
});
});
}
var test = function() {
console.log('yes')
}
function view() {
if( window.jQuery ) {
test()
} else {
setTimeout(function() {
console.log('not')
view(test)
}, 50)
}
}
view(test)
<div class="flex-wrapper" />
<img src="левое.jpg">
<p>lorem100</p>
<img src="правое.jpg" />
</div>
.flex-wrapper {
display:flex;
}
.flex-wrapper img {
width: 200px;
flex-shrink: 0;
}
.flex-wrapper p {
flex-grow: 1;
}