1

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?

Community
  • 1
  • 1
marlen
  • 473
  • 6
  • 20
  • Usually happens if you copy-paste the code, because of special invisible characters. – Mr_Green Sep 20 '12 at 06:48
  • how did you attach you click event to "#n.1" ? maybe you could create a simple fiddle.net example? – Dappergoat Sep 20 '12 at 06:54
  • what do you mean?so what I should do?then it would also not work in firefox,or? – marlen Sep 20 '12 at 06:54
  • @Dappergoat the code exists in the link I provide, there's no reason to duplicate it I think – marlen Sep 20 '12 at 06:56
  • so you copied the code from "how to make twitter bootstrap..." and replaced the "document.getelementbyid" with $("#id-to-select")? Take a look at this: http://stackoverflow.com/questions/350292/how-do-i-get-jquery-to-select-elements-with-a-period-in-their-id and read the part about special characters in jquery selectors. I think it could be the '.' in the ID that messes up your code. – Dappergoat Sep 20 '12 at 07:08
  • forget what I changed. I tried the initial code and it worked in firefox but not in chrome(despite of the dot in the id). Any ideas how I can fix it? – marlen Sep 20 '12 at 07:19

1 Answers1

1

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!

Community
  • 1
  • 1
marlen
  • 473
  • 6
  • 20