How can I assign the src property of an image to another src of another image on my web page
I want to assign this result img.src = jQuery ('# Image1'). Attr ("src");
To another image that I call salida with jquery as follows:
jQuery('#salida').attr("src") = jQuery('#Image1').attr("src");
But it doesn't work for me, how I can change the src of the output image using jquery taking the value of from image1's src
jQuery('#btnCrop').click(function () {
var x1 = jQuery('#imgX1').val();
var y1 = jQuery('#imgY1').val();
var width = jQuery('#imgWidth').val();
var height = jQuery('#imgHeight').val();
var canvas = jQuery("#canvas")[0];
var context = canvas.getContext('2d');
var img = new Image();
img.onload = function () {
canvas.height = height;
canvas.width = width;
context.drawImage(img, x1, y1, width, height, 0, 0, width, height);
jQuery('#imgCropped').val(canvas.toDataURL());
jQuery('#btnUpload').show();
};
img.src = jQuery('#Image1').attr("src");
jQuery('#salida').attr("src") = jQuery('#Image1').attr("src");
});