Paste Input Type File Value To Input Type Text
i have script like this, for append a new elment based user input var tmp; $('#add').click(function(){ var galer=parseInt($('#many').val()); for(var
Solution 1:
Because these elements are being dynamically created you will need to delegate the event listening like
$(window).on( "change", function() {
// var id = $(this).id;
//if (id.indexOf("photo") === 0) {
Solution 2:
the reason that the value of text boxes does not get updated is because they are dynamically created, so the change event is not bind to them.
I have changed your code and optimized it a little like this:
var tmp;
$('#add').click(function(){
var galer = parseInt($('#many').val());
$('.af').remove();
for(var x=1;x<=galer;x++)
$('#kontenPlus').append('<div class="af"><input type="file" id="photo_'+x+'"><input type="text" id="src_'+x+'"></div>');
$('[id^="photo_"]').each(function(){
$(this).change(function(){
$(this).next().val($(this).val());
});
});
});
Post a Comment for "Paste Input Type File Value To Input Type Text"