3
As you can see in the code below, the only things that change is the number at the end of the id, example: (#slide_titulo1
, #slide_titulo2
...). I would like to know how to create a loop of repetition up to 10 and add to the end of the #slide_titulo
, so you don’t have to keep giving 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
})