Note that there are some explanatory texts on larger screens.

plurals
  1. POForget about the previous click when I click on a new object?
    primarykey
    data
    text
    <p>I have a system where you can create a house and some people. When you have created the house, and you then click on it, some information will appear. You'll also get the opportunity to delete the house. </p> <p>However, the system will now forget the previous click if you click on a new house. Therefor both of the houses that I've clicked on, will be removed. </p> <p>You can test it in the <a href="http://jsfiddle.net/Adnaves/t8TKc/" rel="nofollow">JSFIDDLE</a></p> <p>It all happend inside my click function:</p> <pre><code> var objHouse = $('#' + oHouse.id) objHouse.click(function(){ $('#WindowDisplayCarInfo').hide(); $('#WindowDisplayPersonInfo').hide(); $("#WindowDisplayHouseInfo").show(); $('#ShowId').text("ID: " + this.id); $('#ShowStreetName').text("Street Name: " + oHouse.StreetName); $('#ShowNumber').text("Number: " + oHouse.Number); $('#ShowInhabitants').empty(); $('#ShowMaxInhabitants').text("Max inhabitants: " + oHouse.MaxPeople); for(var i = 0; i &lt; oHouse.aPeople.length; i++) { $('#ShowInhabitants').append("&lt;br /&gt;" +"&lt;br /&gt;" + "ID: " + oHouse.aPeople[i].id +"&lt;br /&gt;" + "Name: " + oHouse.aPeople[i].Name +"&lt;br /&gt;" + "Last Name: " + oHouse.aPeople[i].Lastname +"&lt;br /&gt;" + "Age: " + oHouse.aPeople[i].Age +"&lt;br /&gt;" + "Gender: " + oHouse.aPeople[i].sGender ); } $('.DeleteHouse').click(function() { $(objHouse).children().each(function(){ $(this).appendTo($('#container')).css({"top":"" , "left":"", "display":"block"}); }); $(objHouse).remove(); $("#WindowDisplayHouseInfo").hide(); }); }); </code></pre> <p>}</p> <p>(It start at line 130 in the JSFIDDLE.)</p> <p>Hope that you can teach me a trick or two. :-)</p>
    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.
 

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