Reputation: 955
I want to get path of image and assing it to the src of manset_foto
I have this code I could not find what is wrong.
<script type="text/javascript">
$(document).ready(function () {
var path = $('div#onIzlemeler img:first-child').attr('src');
$('#manset_foto').css('display', 'none').fadeIn('slow').attr('src', path);
$('div#onIzlemeler img').mouseenter(function () {
$('#manset_foto').css('display', 'none').fadeIn('slow').attr('src', $(this).att('src'));
});
});
</script>
<div id="onIzlemeler">
<img src="slider/1.jpg" alt="" />
<img src="slider/2.jpg" alt="" />
<img src="slider/3.jpg" alt="abla" />
<img src="slider/4.jpg" alt="!" />
<img src="slider/5.jpg" alt="" />
</div>
<div id="manset">
<img id="manset_foto"/>
<p id="manset_bilgi"></p>
</div>
Upvotes: 0
Views: 333
Reputation: 74748
Seems you are missing "r" of .attr()
method here:
$('#manset_foto').css('display', 'none').fadeIn('slow')
.attr('src', $(this).att('src'));
//----------------------^----here "r" is missing in .attr()
Upvotes: 1
Reputation: 133453
You need to use variable path
var path = $('div#onIzlemeler img:first-child').attr('src');
$('#manset_foto').css('display', 'none').fadeIn('slow').attr('src', path);
Currently You are using yol
use .attr()
instead of .att()
Your other mistake is in line .attr('src', $(this).att('src'))
Upvotes: 2