Hiatchi Pwns
New Member
In this Fiddle, a jQuery dialog is displayed when you click on an image. The dialog should contain text specific to the image, for example, a text on law firms for the law firms image, a text on industry for the industry image, etc. The problem is that once you've clicked each of the three images, any further click on any image returns the dialog that relates to the last of the three images you clicked, rather than the dialog for the image you've just clicked. Can someone please point out what I've got wrong?HTML<div id="sf"> <a href="http://stackoverflow.com/questions/15585918/dialogcontent/lawfirms.html" title="Law firms" id="sfimage"> <div class="circle hovershadow lawfirms lawfirms-box-shadow">Law firms</div> </a> <a href="http://stackoverflow.com/questions/15585918/dialogcontent/industry.html" title="Industry" id="sfimage"> <div class="circle hovershadow industry industry-box-shadow">Industry</div> </a> <a href="http://stackoverflow.com/questions/15585918/dialogcontent/in-house.html" title="In-house legal counsel" id="sfimage"> <div class="circle hovershadow in-house in-house-box-shadow text">In-house legal counsel</div> </a></div>Javascript:$(document).ready(function () {var $loading = $('<img src="http://ubuntuone.com/5qQ3i4ctM8HAvRsSIZKgqd" alt="Loading ..." class="loading">'); var $dialog = $('<div></div>')$('#sf a').each(function () { $dialog.append($loading.clone()); var $link = $(this).one('click', function () { $dialog.load($link.attr('href') + ' #content') .dialog({ title: $link.attr('title'), width: 500, height: 300 }); $link.click(function (e) { // e.preventDefault(); $dialog.dialog('open'); return false; }); return false; });});});