Simply dont understand why jquery .click()
cannot be executed, cause everytime the element is fired I got an error you have seen in the title.
I have an element which is linked to my document by name B Group
and I'm calling to that element like $('a[href="#B Group"]')
. As you can see it has a space inside. Is it a misunderstanding for me or there cant be spaces inside?
my code
$(document).on('click', '.groups-activity .glyphicon-list',
function () {
var target = $(this).parents('tr');
var name = target.find('td').slice(3, 4).text().trim();
if ($('a[href = "#' + name + '"]').length > 0) {
$('a[href="#' + name + '"]').click();
return 0;
}
activityGroups.push(name);
$('.tabs').append('<li class="groups tab col s3"><a data-admin="false" class="data-tab" href="#' + name + '">' + name + '</a><span class="close-tab">×</span></li>');
$('a[href="#' + name + '"]').click();
$.ajax({
type: 'POST',
url: '/Admin/CheckArray',
data: { activityGroups: activityGroups }
});
});