0

I am trying to create a next button which will be triggered to change a section in a single tab. Steps I am using: 1st I need to get the url of the current tab and apply if condition to that url to check whether I should go to next section or not. If true then I will use the id in that url along with triggerClick event idtriggerClick

Code:

var currentURL = window.location.href;
if(currentURL =="http://localhost/xyz/store?id=7"){
    id.trigger('click') //Now how to move onto the next section after an event is triggered.
}
else
A.A Noman
  • 5,244
  • 9
  • 24
  • 46

1 Answers1

0

You can do this without specifying id in url. You need to use javascript/jquery for this. Below are reference steps to achieve this.

Javascript has windows global object, you can create your custom object inside it at very beginning of your code.

window.customobject = {
        step_one : true;
        step_two : false;
};

Trigger a button click and update step object.

jQuery('#buttonId').click(function(e){
     window.customobject.step_one = false;
     window.customobject.step_two = true;
});

Check the step object and update the section in your webpage.

jQuery('#buttonId').click(function(e){
         window.customobject.step_one = false;
         window.customobject.step_two = true;
         if(window.customobject.step_two){
            //Update your content section
         }  
});

Hope this helps!

Thanks

Kapil Yadav
  • 650
  • 1
  • 5
  • 29
  • 1
    What is the meaning or use of parameter 'e' that is passed inside a function. – hello world Jan 25 '18 at 06:53
  • It's click event object. We have bind click event in "#buttonId", So when we click on this button, click event is fired and "e" is object of that click event. It's passed in function If inside the function definition we want to use of event object. – Kapil Yadav Jan 25 '18 at 09:09