What should i replace to click this navbar called security printing? Im new with laravel.
$('.anotha').on('click', function () {
if ($(this).on(':clicked')) {
$('#secur').clicked();
}
})
I know its wrong code. But I tried
$('.anotha').on('click', function () {
if ($(this).on(':clicked')) {
$('#secur').click();
}
})
Nothing happened too, still the current active navbar is the about us
$('.anotha').on('click', function () {
if ($(this).on(':clicked')) {
$('#secur').show();
}
});
Nothing happened because the tab-item is already showed. same as
$('.anotha').on('click', function () {
if ($(this).on(':clicked')) {
$('#secur').select();
}
})
and
$('.anotha').on('click', function () {
if ($(this).on(':clicked')) {
$('#secur').selected();
}
})
UPDATE:
When I remove the if clause the code will look like this:
$('.anotha').on('click', function () {
$('#secur').selected();
})
Same as other code but nothing happened still.
Every HTML element has a click() method that can be called to simulate a mouse click.
document.getElementById('#secur').click();
jQuery provides it's own method that wraps this feature.
$('.anotha').on('click', function () {
$('#secur').click();
})
By the way, this does not require jQuery to accomplish. The following code would be the equivalent in plain javascript.
let a = document.querySelectorAll('.anotha');
let s = document.querySelector('#secur');
a.forEach(x => {
x.addEventListener('click', event => {
s.click();
});
});
s.addEventListener('click', event => {
console.log('#secur was clicked');
});