Skip to content

Instantly share code, notes, and snippets.

@keshavsaharia
Created November 23, 2013 02:34
Show Gist options
  • Save keshavsaharia/7610053 to your computer and use it in GitHub Desktop.
Save keshavsaharia/7610053 to your computer and use it in GitHub Desktop.
product 1
$(document).ready(function() {
$('#productList').empty();
for (var i in products) {
var product = products[i];
$('#productList').append(
$('<div></div>') // make a div
.addClass('col-md-4 portfolio-item')
.append(
$('<a></a>')
.attr('href', 'linktome.html')
.append(
$('<img>')
.attr('style', 'width:100%')
.attr('src', product.image)
)
)
.append(
$('<h3></h3>')
.append(
$('<a></a>')
.attr('href', 'test.html')
.html(product.name)
)
)
.append(
$('<p></p>')
.html(product.description)
)
.append(
$('<h3></h3>')
.html('$' + product.price)
.append(
$('<button></button>')
.attr('class', 'btn btn-success')
.attr('style', 'float:right')
.append('buy now')
)
)
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment