HTML5 Data-block JSON

Okay so this code:

<div class="summary-block" data-block-json="{"pageSize":4,"acceptTypes":["gallery","blog","projects","calendar"]}">

I'm trying to use some jQuery to accomplish something like this:

$(".summary-block").data('block', 'pageSize').each(function() {

  $('.summary-item').wrap('<div class="col sqs-col-3 span-3"></div>');
  $('.col > .summary-item').wrap('<div class="newSummary"></div>');


Now the code works 100%, but not 100% in terms of what I'm trying to ask it. How can I make it so its like:

$(".summary-block").data('block', 'pageSize':4).each(function() {

  $('.summary-item').wrap('<div class="col sqs-col-3 span-3"></div>');
  $('.col > .summary-item').wrap('<div class="newSummary"></div>');


Notice the :4 this must be included somehow in my code. Please help. Thanks!


You don't filter the elements, you are only setting new data attributes, not selecting the elements that have specific data attributes, also in your each function context you should use this which refers to the current element not $('.summary-item') and you should code data('block-json'), not data('block'). You can use filter method.

<div class="summary-block" data-block-json='{"pageSize":4,"acceptTypes":["gallery","blog","projects","calendar"]}'>...</div>

var $elems = $('.summary-block').filter(function(){
    return $(this).data('block-json').pageSize === 4

    $('.summary-item', this).wrap('<div class="col sqs-col-3 span-3"></div>');
    // or $(this).find('.summary-item')....

Need Your Help “Message must be no more than 64kB”

laravel queue

I am trying to send an Email through service. Everything is working as expected except that if the body of the message is big I get this error.

Create an array of MKPointAnnotation objects


Currently working with Map Views and adding pins to the map. I know how to add a single point to the map using addAnotation() method. Now, I am trying to add multiple points to the MapView in the e...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.