I have got this HTML code
<img src="../img/1.jpg" class="img">
<img src="../img/2.jpg" class="img">
<img src="../img/3.jpg" class="img">
<img src="../img/4.jpg" class="img">
<input type="file" name="file" id="file" onchange="bgchange(this)" >
And this jquery
$(".img").click(function(){
var srcat=$(this).attr('src');
$("#file").attr('value',srcat);
alert($("#file").val());
});
But it is not changing any value it stays empty.Is there anyway i can change that?