I’m trying to replace the text in the ‘biginfotitle’ div with the text from the ‘slidertitle’ div. I’ve got the source of the photo to change, but can’t figure out what I’m doing wrong with replicating the text in the div.
<script>
$(document).ready(function(){
$('.scrollcontent').click(function(){
var $this = $(this);
csrc=$this.children('img.thumbpic#'+this.id).attr('src');
ctitle=$('.slidertitle#'+this.id).text();
$('img#mainpic').attr("src",csrc);
$('div#biginfotitle').text(ctitle);
//alert(ctitle);
});
});
</script>
<div class="scrollcontent" id="23">
<img class="thumbpic" id="23" src="/smallthumbs/24.jpg" />
<div id="thumbinfo">
<div class="slidertitle" id="23">Click to change to this</div>
</div>
</div>
<div id="slidercontent">
<img id="mainpic" src="/thumbs/blah.jpg" />
<div id="biginfo">
<div id="biginfotitle">Change Me</div>
</div>
</div>
you can not have several times the same “ID” in various elements, this must be unique:
see this:
example