I want to trrigger click event on span tag onclick happed.
li created when create/click span tag( create collection) click.
below is my span nd ul li tag. li list added dynamically into the ul when click on the span.
i want trigger click event on li only data-encat value will be 0. Otherwise no need to trigger.
<span data-object_id="2089" class="cbxwpbkmark-field-create-submit" title="Create Collection"></span>
<ul class="cbxlbjs-list cbxwpbkmarklist" style="" data-type="product" data-object_id="670">
<li class="cbxlbjs-item" data-catname="2563" data-privacy="0" data-incat="1" data-value="64">
<span title="2563" class="cbxlbjs-item-name">2563</span>
</li>
<li class="cbxlbjs-item" data-catname="testt" data-privacy="0" data-incat="0" data-value="65">
<span title="testt" class="cbxlbjs-item-name">testt</span></li>
<li class="cbxlbjs-item" data-catname="gdgfd" data-privacy="0" data-incat="1" data-value="66">
<span title="gdgfd" class="cbxlbjs-item-name">gdgfd</span></li>
</ul>
Below is my jquery code i m trying but it apply all the data-cat values(li)
jQuery('.cbxwpbkmark-field-create-submit').click(function() {
setTimeout(function(){
var successmesg = $('.cbxwpbkmark-form-note-success').html();
if(successmesg == 'Done successfully!')
{
//var a = $("li.cbxlbjs-item").length;
//alert(a);
$('.cbxlbjs-item').trigger("click");
$('.cbxwpbkmark-toolbar-listcat').trigger("click");
}
}, 3000);
});
ANyone have idea how to do this then let me know.
2
Answers
You could use something like this:
Can you try:
or
Not tested.