Trigger tab click event via button










0















How can I trigger click on 2nd tab event via butto, with jquery?



enter image description here



$('#packingGrid2').trigger('click');


I tried do this with trigger pasted above, but it doesnt work. Any thoughts?










share|improve this question






















  • Are you sure your selector is correct?

    – Mohammad
    Nov 14 '18 at 9:02











  • Yes, console.log($('#packingGrid')); returns me "jQuery.fn.init context: document, selector: "#packingGrid2""

    – Paweł Nowicki
    Nov 14 '18 at 9:05












  • Are you sure it's a click event you need to trigger? Assuming you're attempting to change the active tab, is there no method in the tab library you're using? Or other event to raise?

    – Rory McCrossan
    Nov 14 '18 at 9:07











  • I mean I can go to 2nd tab through clicking on tab header and it works fine, but I dont know how to achieve the same result with clicking on button. I thought its a click event.

    – Paweł Nowicki
    Nov 14 '18 at 9:09












  • Try to manipulate CSS classes which make the selected tab "active"

    – kmos.w
    Nov 14 '18 at 9:19















0















How can I trigger click on 2nd tab event via butto, with jquery?



enter image description here



$('#packingGrid2').trigger('click');


I tried do this with trigger pasted above, but it doesnt work. Any thoughts?










share|improve this question






















  • Are you sure your selector is correct?

    – Mohammad
    Nov 14 '18 at 9:02











  • Yes, console.log($('#packingGrid')); returns me "jQuery.fn.init context: document, selector: "#packingGrid2""

    – Paweł Nowicki
    Nov 14 '18 at 9:05












  • Are you sure it's a click event you need to trigger? Assuming you're attempting to change the active tab, is there no method in the tab library you're using? Or other event to raise?

    – Rory McCrossan
    Nov 14 '18 at 9:07











  • I mean I can go to 2nd tab through clicking on tab header and it works fine, but I dont know how to achieve the same result with clicking on button. I thought its a click event.

    – Paweł Nowicki
    Nov 14 '18 at 9:09












  • Try to manipulate CSS classes which make the selected tab "active"

    – kmos.w
    Nov 14 '18 at 9:19













0












0








0








How can I trigger click on 2nd tab event via butto, with jquery?



enter image description here



$('#packingGrid2').trigger('click');


I tried do this with trigger pasted above, but it doesnt work. Any thoughts?










share|improve this question














How can I trigger click on 2nd tab event via butto, with jquery?



enter image description here



$('#packingGrid2').trigger('click');


I tried do this with trigger pasted above, but it doesnt work. Any thoughts?







javascript jquery triggers






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 14 '18 at 9:00









Paweł NowickiPaweł Nowicki

256




256












  • Are you sure your selector is correct?

    – Mohammad
    Nov 14 '18 at 9:02











  • Yes, console.log($('#packingGrid')); returns me "jQuery.fn.init context: document, selector: "#packingGrid2""

    – Paweł Nowicki
    Nov 14 '18 at 9:05












  • Are you sure it's a click event you need to trigger? Assuming you're attempting to change the active tab, is there no method in the tab library you're using? Or other event to raise?

    – Rory McCrossan
    Nov 14 '18 at 9:07











  • I mean I can go to 2nd tab through clicking on tab header and it works fine, but I dont know how to achieve the same result with clicking on button. I thought its a click event.

    – Paweł Nowicki
    Nov 14 '18 at 9:09












  • Try to manipulate CSS classes which make the selected tab "active"

    – kmos.w
    Nov 14 '18 at 9:19

















  • Are you sure your selector is correct?

    – Mohammad
    Nov 14 '18 at 9:02











  • Yes, console.log($('#packingGrid')); returns me "jQuery.fn.init context: document, selector: "#packingGrid2""

    – Paweł Nowicki
    Nov 14 '18 at 9:05












  • Are you sure it's a click event you need to trigger? Assuming you're attempting to change the active tab, is there no method in the tab library you're using? Or other event to raise?

    – Rory McCrossan
    Nov 14 '18 at 9:07











  • I mean I can go to 2nd tab through clicking on tab header and it works fine, but I dont know how to achieve the same result with clicking on button. I thought its a click event.

    – Paweł Nowicki
    Nov 14 '18 at 9:09












  • Try to manipulate CSS classes which make the selected tab "active"

    – kmos.w
    Nov 14 '18 at 9:19
















Are you sure your selector is correct?

– Mohammad
Nov 14 '18 at 9:02





Are you sure your selector is correct?

– Mohammad
Nov 14 '18 at 9:02













Yes, console.log($('#packingGrid')); returns me "jQuery.fn.init context: document, selector: "#packingGrid2""

– Paweł Nowicki
Nov 14 '18 at 9:05






Yes, console.log($('#packingGrid')); returns me "jQuery.fn.init context: document, selector: "#packingGrid2""

– Paweł Nowicki
Nov 14 '18 at 9:05














Are you sure it's a click event you need to trigger? Assuming you're attempting to change the active tab, is there no method in the tab library you're using? Or other event to raise?

– Rory McCrossan
Nov 14 '18 at 9:07





Are you sure it's a click event you need to trigger? Assuming you're attempting to change the active tab, is there no method in the tab library you're using? Or other event to raise?

– Rory McCrossan
Nov 14 '18 at 9:07













I mean I can go to 2nd tab through clicking on tab header and it works fine, but I dont know how to achieve the same result with clicking on button. I thought its a click event.

– Paweł Nowicki
Nov 14 '18 at 9:09






I mean I can go to 2nd tab through clicking on tab header and it works fine, but I dont know how to achieve the same result with clicking on button. I thought its a click event.

– Paweł Nowicki
Nov 14 '18 at 9:09














Try to manipulate CSS classes which make the selected tab "active"

– kmos.w
Nov 14 '18 at 9:19





Try to manipulate CSS classes which make the selected tab "active"

– kmos.w
Nov 14 '18 at 9:19












1 Answer
1






active

oldest

votes


















0














@Keydose, there is my code.



 $items = [
[
'url' => Yii::$app->params['pjax_enabled']?null:Url::to(['step_1', 'tab' => 'packingGrid1']),
'label' => '<i class="glyphicon glyphicon-check"></i> Weryfikacja linii',
'content' => Yii::$app->controller->renderPartial('step_1', [
'gridId' => 'packingGrid1',
'model' => $model,
'form' => $form,
]),
'linkOptions' => [
'data-id' => 'packingGrid1',
],
],
[
'url' => Yii::$app->params['pjax_enabled']?null:Url::to(['step_2', 'tab' => 'packingGrid2']),
'label' => '<i class="glyphicon glyphicon-user"></i> Ustawienia pracowników',
'content' => ($model->isNewRecord) ? '<strong>Uzupełnij weryfikację linii</strong>' :
Yii::$app->controller->renderPartial('step_2', [
'gridId' => 'packingGrid2',
'model' => $model,
'form' => $form,
]),
'linkOptions' => [
'data-id' => 'packingGrid2',
],
'active' => ($model->isNewRecord) ? false : true,
],
],
];
echo TabsX::widget([
'items' => $items,
'position' => TabsX::POS_ABOVE,
'encodeLabels'=>false,
'bordered'=>true,
]);





share|improve this answer























  • I quit with TabsX widget. I have created my own tabs, where I have full control of them, topic is closed.

    – Paweł Nowicki
    Nov 15 '18 at 9:01










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53296340%2ftrigger-tab-click-event-via-button%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














@Keydose, there is my code.



 $items = [
[
'url' => Yii::$app->params['pjax_enabled']?null:Url::to(['step_1', 'tab' => 'packingGrid1']),
'label' => '<i class="glyphicon glyphicon-check"></i> Weryfikacja linii',
'content' => Yii::$app->controller->renderPartial('step_1', [
'gridId' => 'packingGrid1',
'model' => $model,
'form' => $form,
]),
'linkOptions' => [
'data-id' => 'packingGrid1',
],
],
[
'url' => Yii::$app->params['pjax_enabled']?null:Url::to(['step_2', 'tab' => 'packingGrid2']),
'label' => '<i class="glyphicon glyphicon-user"></i> Ustawienia pracowników',
'content' => ($model->isNewRecord) ? '<strong>Uzupełnij weryfikację linii</strong>' :
Yii::$app->controller->renderPartial('step_2', [
'gridId' => 'packingGrid2',
'model' => $model,
'form' => $form,
]),
'linkOptions' => [
'data-id' => 'packingGrid2',
],
'active' => ($model->isNewRecord) ? false : true,
],
],
];
echo TabsX::widget([
'items' => $items,
'position' => TabsX::POS_ABOVE,
'encodeLabels'=>false,
'bordered'=>true,
]);





share|improve this answer























  • I quit with TabsX widget. I have created my own tabs, where I have full control of them, topic is closed.

    – Paweł Nowicki
    Nov 15 '18 at 9:01















0














@Keydose, there is my code.



 $items = [
[
'url' => Yii::$app->params['pjax_enabled']?null:Url::to(['step_1', 'tab' => 'packingGrid1']),
'label' => '<i class="glyphicon glyphicon-check"></i> Weryfikacja linii',
'content' => Yii::$app->controller->renderPartial('step_1', [
'gridId' => 'packingGrid1',
'model' => $model,
'form' => $form,
]),
'linkOptions' => [
'data-id' => 'packingGrid1',
],
],
[
'url' => Yii::$app->params['pjax_enabled']?null:Url::to(['step_2', 'tab' => 'packingGrid2']),
'label' => '<i class="glyphicon glyphicon-user"></i> Ustawienia pracowników',
'content' => ($model->isNewRecord) ? '<strong>Uzupełnij weryfikację linii</strong>' :
Yii::$app->controller->renderPartial('step_2', [
'gridId' => 'packingGrid2',
'model' => $model,
'form' => $form,
]),
'linkOptions' => [
'data-id' => 'packingGrid2',
],
'active' => ($model->isNewRecord) ? false : true,
],
],
];
echo TabsX::widget([
'items' => $items,
'position' => TabsX::POS_ABOVE,
'encodeLabels'=>false,
'bordered'=>true,
]);





share|improve this answer























  • I quit with TabsX widget. I have created my own tabs, where I have full control of them, topic is closed.

    – Paweł Nowicki
    Nov 15 '18 at 9:01













0












0








0







@Keydose, there is my code.



 $items = [
[
'url' => Yii::$app->params['pjax_enabled']?null:Url::to(['step_1', 'tab' => 'packingGrid1']),
'label' => '<i class="glyphicon glyphicon-check"></i> Weryfikacja linii',
'content' => Yii::$app->controller->renderPartial('step_1', [
'gridId' => 'packingGrid1',
'model' => $model,
'form' => $form,
]),
'linkOptions' => [
'data-id' => 'packingGrid1',
],
],
[
'url' => Yii::$app->params['pjax_enabled']?null:Url::to(['step_2', 'tab' => 'packingGrid2']),
'label' => '<i class="glyphicon glyphicon-user"></i> Ustawienia pracowników',
'content' => ($model->isNewRecord) ? '<strong>Uzupełnij weryfikację linii</strong>' :
Yii::$app->controller->renderPartial('step_2', [
'gridId' => 'packingGrid2',
'model' => $model,
'form' => $form,
]),
'linkOptions' => [
'data-id' => 'packingGrid2',
],
'active' => ($model->isNewRecord) ? false : true,
],
],
];
echo TabsX::widget([
'items' => $items,
'position' => TabsX::POS_ABOVE,
'encodeLabels'=>false,
'bordered'=>true,
]);





share|improve this answer













@Keydose, there is my code.



 $items = [
[
'url' => Yii::$app->params['pjax_enabled']?null:Url::to(['step_1', 'tab' => 'packingGrid1']),
'label' => '<i class="glyphicon glyphicon-check"></i> Weryfikacja linii',
'content' => Yii::$app->controller->renderPartial('step_1', [
'gridId' => 'packingGrid1',
'model' => $model,
'form' => $form,
]),
'linkOptions' => [
'data-id' => 'packingGrid1',
],
],
[
'url' => Yii::$app->params['pjax_enabled']?null:Url::to(['step_2', 'tab' => 'packingGrid2']),
'label' => '<i class="glyphicon glyphicon-user"></i> Ustawienia pracowników',
'content' => ($model->isNewRecord) ? '<strong>Uzupełnij weryfikację linii</strong>' :
Yii::$app->controller->renderPartial('step_2', [
'gridId' => 'packingGrid2',
'model' => $model,
'form' => $form,
]),
'linkOptions' => [
'data-id' => 'packingGrid2',
],
'active' => ($model->isNewRecord) ? false : true,
],
],
];
echo TabsX::widget([
'items' => $items,
'position' => TabsX::POS_ABOVE,
'encodeLabels'=>false,
'bordered'=>true,
]);






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 14 '18 at 10:22









Paweł NowickiPaweł Nowicki

256




256












  • I quit with TabsX widget. I have created my own tabs, where I have full control of them, topic is closed.

    – Paweł Nowicki
    Nov 15 '18 at 9:01

















  • I quit with TabsX widget. I have created my own tabs, where I have full control of them, topic is closed.

    – Paweł Nowicki
    Nov 15 '18 at 9:01
















I quit with TabsX widget. I have created my own tabs, where I have full control of them, topic is closed.

– Paweł Nowicki
Nov 15 '18 at 9:01





I quit with TabsX widget. I have created my own tabs, where I have full control of them, topic is closed.

– Paweł Nowicki
Nov 15 '18 at 9:01



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53296340%2ftrigger-tab-click-event-via-button%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo