How about, instead of: x = this.id; try: x = $(this).attr('id');
On Feb 6, 1:22 am, Mario Moura <moura.ma...@gmail.com> wrote: > Hi Folks > > I did this with ajax tab options and Jquery Form > > $(document).ready(function() { > $("#myForm").ajaxForm( function() { > $("#tabs").tabs("select",2); > }); > > }); > > Inside of my tab 1 have > > <input type="submit" id="back" class="click" value="« Back" name="back"/> > > <input type="submit" id="continue" class="click" value="Continue »" > name="continue"/> > > As you can see if I submit #myForm I will go to next tab > $("#tabs").tabs("select",2); > > But to back I am having problems. Because is a second submit button. So I am > trying this: > > $(document).ready(function() { > > $(".click").click(function(){ > //Get the id of this clicked item > x = this.id; > > }); > > // before submit, call BackOrContinue > var options = { > beforeSubmit: BackOrContinue > }; > > $("#myform").ajaxForm(options); > > function BackOrContinue { > > if (x == "back") { > $("#tabs").tabs("select",0); > } else { > $("#tabs").tabs("select",2); > } > } > > }); > > My error is $ is not defined > > I tried > > $("#myForm").ajaxForm( function() { > x = this.id; > alert(x); > if (x == "back") { > $("#tabs").tabs("select",0); > } else { > $("#tabs").tabs("select",2); > } > }); > > and x = "undefined" > > What is missing? > > Regards > > macm