Q:

sending div id through button click java-script method parameter

can anyone please tell me how to send div id through button click java-script parameter.
Here in the below code the main div id 'ricId_1' and the class name "ric_class1 rico_class0 ric1_class1 ric2_class3" is created dynamically has to be send through javascript method cancel('divid') in the button click.The div id is not static.
<div id="ricId_1" class="ric_class1 rico_class0 ric1_class1 ric2_class3" style="width: 730px; left: 309px; top: 71.5px; z-index: 13000; display: block;">
        <div class="ricTitle">
            :
        </div>

        <div class="ricModal ng-scope" style="height: auto;">
            :
        <div>

        <div>
            <div ng-controller="Manage" class="ng-scope">
                <div class="ricG ricAlign">
                    <div class="ricGrid"><div class="ricGridTable">
                     :
                    </div>
                </div>
            </div>
        </div>

        <div align="center" class="row btn-group">
            <button onclick="cancel('divid')" class="ricButton" type="button" id="sss" ric:loaded="true">Close</button>
        </div>

    </div>

A:

Pass the button to cancel and use that id to get the closes ancestor with class ric_class1 rico_class0 ric1_class1 ric2_class3 having id ricId_1
Live Demo
Html
<button onclick="cancel(this)" class="ricButton" type="button" id="sss" ric:loaded="true">Close</button>

Javascript
function cancel(btn)
{
     ricId_1 = $(btn).closest('ric_class1 rico_class0.ric1_class1 ric2_class3');
     //or
     ricId_1 = $(btn).parent().parent();

}

