I am using .after to add a table to my website but I need values from a variable to be inserted in the cell. It seems like I cannot access them. Possibly I am taking a completely wrong approach.
var object0001= {price: 1000, bedrooms:2}
$(document).ready(function() {
$("#dot0003").hover(
function(){
$("#tablespace").after(
'<table border="4">'+
'<tr><td>price</td>' '<td>object0001.price</td></tr>'+
'<tr><td>number of bedrooms</td>' '<td>object0001.bedrooms</td></tr>'+
'<tr><td>livingroom</td>' '<td><img src="_index/_dots/dot.gif" width="20" height="20"></td></tr></table>')
});
});
Any help appreciated!
It should be like this
whatever is between the ” is a string , and not to be parsed as JavaScript
try to make all of the html in a variable , then pass it to append , it will save you time when you try to maintain the code