Como podem ver no código abaixo, as únicas coisas que mudam é o número no final do id, exemplo: (#slide_titulo1
, #slide_titulo2
...). Gostaria de saber como poderia fazer para criar um laço de repetição até 10 e ir adicionando ao final do #slide_titulo
, para não precisar ficar dando ctrl c + ctrl v.
$(document).ready(function() {
//slide 1
$('#tituloSlideInput1').on('change', function() {
var value = $(this).val();
$('#slide_titulo1').text(value);
})
$('#textoSlideInput1').on('change', function() {
var value = $(this).val();
$('#slide_texto1').text(value);
})
//slide 1
//slide 2
$('#tituloSlideInput2').on('change', function() {
var value = $(this).val();
$('#slide_titulo2').text(value);
})
$('#textoSlideInput2').on('change', function() {
var value = $(this).val();
$('#slide_texto2').text(value);
})
//slide 2
//slide 3
$('#tituloSlideInput3').on('change', function() {
var value = $(this).val();
$('#slide_titulo3').text(value);
})
$('#textoSlideInput3').on('change', function() {
var value = $(this).val();
$('#slide_texto3').text(value);
})
//slide 3
})