[jQuery] Back or Continue Solution to UI Tabs and Jquery Form
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 = <a href="http://this.id/" target="_blank">this.id</a>;
});
// before submit, call BackOrContinue
var options = {
beforeSubmit: BackOrContinue
};
$("#myform").ajaxForm(options)<div id=":2md" class="ArwC7c ckChnd">;
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 = <a href="http://this.id/" target="_blank">this.id</a>;
alert(x);
if (x == "back") {
$("#tabs").tabs("select",0);
} else {
$("#tabs").tabs("select",2);
}
});
and x = "undefined"
What is missing?
Regards
macm</div>