Problema de cod JS

showb1z

Well-Known Member
Registered
Full Member
Problema codului este ca nu inlocuieste atributul src din parseHTML !
JavaScript:
$(function() {
    // Multiple images preview in browser
    var imagesPreview = function(input, placeToInsertImagePreview) {

        if (input.files) {
            var filesAmount = input.files.length;

            for (i = 0; i < filesAmount; i++) {
                var reader = new FileReader();

                reader.onload = function(event) {
                    $($.parseHTML('<div class="image radius has-image" ng-repeat="picture in Pictures"><div class="picture loader-inline"><img ng-show="picture.Id > 1" ng-src="" src=""><span class="fa fa-circle-o-notch maincolor" style="display:none;"></span></div><div class="action"><span class="fa fa-rotate-left ng-scope" ng-if="picture.Blocked === false || picture.Blocked == null" ng-click="rotateToLeft(picture)"></span><span class="fa fa-trash ng-scope" ng-if="picture.Blocked === false || picture.Blocked == null" ng-click="deletePicture(picture)"></span><span class="fa fa-rotate-right ng-scope" ng-if="picture.Blocked === false || picture.Blocked == null" ng-click="rotateToRight(picture)"></span></div></div>')).attr('src', event.target.result).appendTo(placeToInsertImagePreview);
                }

                reader.readAsDataURL(input.files[i]);
            }
        }

    };

    $('#gallery-photo-add').on('change', function() {
        imagesPreview(this, 'div.gallery');
    });
});

Ma poate ajuta cineva cu un sfat ?

Codul normal era parseHTML('<img') si am adaugat eu acel div etc
 
Loading...
Back
Sus