Note that there are some explanatory texts on larger screens.

plurals
  1. POIncorrect selection of jQuery dialog
    primarykey
    data
    text
    <p>In <a href="http://jsfiddle.net/cvh2013/EWebt/3/" rel="nofollow">this</a> 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. </p> <p>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. </p> <p>Can someone please point out what I've got wrong?</p> <p>HTML</p> <pre><code>&lt;div id="sf"&gt; &lt;a href="dialogcontent/lawfirms.html" title="Law firms" id="sfimage"&gt; &lt;div class="circle hovershadow lawfirms lawfirms-box-shadow"&gt;Law firms&lt;/div&gt; &lt;/a&gt; &lt;a href="dialogcontent/industry.html" title="Industry" id="sfimage"&gt; &lt;div class="circle hovershadow industry industry-box-shadow"&gt;Industry&lt;/div&gt; &lt;/a&gt; &lt;a href="dialogcontent/in-house.html" title="In-house legal counsel" id="sfimage"&gt; &lt;div class="circle hovershadow in-house in-house-box-shadow text"&gt;In-house legal counsel&lt;/div&gt; &lt;/a&gt; &lt;/div&gt; </code></pre> <p>Javascript:</p> <pre><code>$(document).ready(function () { var $loading = $('&lt;img src="http://ubuntuone.com/5qQ3i4ctM8HAvRsSIZKgqd" alt="Loading ..." class="loading"&gt;'); var $dialog = $('&lt;div&gt;&lt;/div&gt;') $('#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; }); }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload