Creating a table with dynamically highlighted columns like Crazy Egg’s pricing table

Posts Tagged ‘dynamic elements’
Dynamically Creating a table and highlighted columns
Dynamically Creating a table and highlighted columnsDynamically Add Remove Elements using jQuery
Dynamically Add Remove Elements using jQuerySample code snippet for Adding and Removing the Elements dynamically using jQuery
{code type=html}
{/code}
Javascript
{code type=html}
$(document).ready(function() {
$(“#addchoice”).click(function(){
//getting the current element count
var current = $(“#answercount”).val();
current = Number(++current);
//Append the html content
$(“#choiceTemplate”).append(”
“);
//assign the current element count
$(“#answercount”).val(current);
return false;
});
//remove the elements
$(“#removechoice”).click(function(){
//getting the current/last element count
var current = $(“#answercount”).val();
//removing the element
$(‘#current’+current).remove();
//assign the current element count
current = Number(–current);
$(“#answercount”).val(current);
});
});
{/code}
Submitted By : Raja

