marlen
marlen

Reputation: 483

.click() works in firefox but not in chrome

I use the solution suggested in the answer to this question

How to make twitter bootstrap tab as form wizard?

because I need the same functionality and it works great in firefox but in chrome I get:

Uncaught TypeError: Object.../localhost:..../#otherIncome1 has no method 'click'

I am aware that .click() on elements isn't supported in chrome (or am I wrong?). I've found related questions but nothings seems to work.

I've tried: "$('#n.1').click()" or "$('#n.1').trigger('click')"

I get no errors but still doesn't work. Any hints?

Upvotes: 1

Views: 1132

Answers (1)

marlen
marlen

Reputation: 483

It seems that I found a solution that works in both chrome and firefox. I used the code in the first answer to this question: How to simulate a mouse click using JavaScript?

combined with:

 $("#b1n").click(function ()
   {
    simulate(document.getElementById("n.2"), "click");
   });
 $("#b2n").click(function ()
   {
    simulate(document.getElementById("n.3"), "click");
   }); 

...for all the buttons and also changed the buttons in this way: from this:

<button onclick="document.getElementById('n.2').click()">next</button>

to this:

 <button id='b2n'>next</button>

and..that's all!

Upvotes: 1

Related Questions