Q:

get parameter from a class search

Say I have this:
<div id="container">
    <div>
        <div class="main" data-id="thisID">
        </div>
    </div>
</div>

How do I get the parameter result inside data-id if I do a class search?
var el = $('#container');
var row = el.find(".main");

Then after this, not sure how to use "row" to get the string id from data-id.

A:

Use jQuery .data() or Element.dataset
var el = $('#container');
var row = el.find(".main");
var id = row.data("id");

var el = $('#container');
var row = el.find(".main");
var id = row[0].dataset.id;

