 <p>Another way to do it simpler using jquery.</p> <p>sample: </p> <pre><code>function add(product_id){ // the code to add the product //updating the div, here I just change the text inside the div. //You can do anything with jquery, like change style, border etc. $("#added_"+product_id).html('the product was added to list'); } </code></pre> <p>Where product_id is the javascript var and$("#added_"+product_id) is a div id concatenated with product_id, the var from function add. </p> <p>Best Regards!</p>