i have a div which has many divs.when binding the divs i create click event for each item like below
jQuery.each(opts.items, function (i, item)
{
var image = opts.image;
jQuery('jQuery('<div class="' + opts.optionClassName + opts.controlId + '" id="' + item.key + '" ><img src="' + image + '" alt="checkbox" />' + item.value + '</div>')
.click(function ()
{')
.click(function ()
{
//code goes here
}
when the div is clicked in UI this gets triggered, but when i try to do it manually it does not get triggered. any help on how to trigger would be great. i hardcoded the div values and tried to call but it is of no use.
var id1 = 'Car';
var id2 = 'Bus';
$('div class="CList" id="1" >' + id1 + '</div>').trigger('click');
$('div class="CList" id="3" >' + id2 + '</div>').trigger('click');
even this
var id1 = 'Car';
var id2 = 'Bus';
$('div class="CList" id="1" >' + id1 + '</div>')[0].click();
$('div class="CList" id="3" >' + id2 + '</div>')[0].click();