I really need some help here. So I am using one Jquery Steps PlugIn. Now in this PlugIn when we go to the last tab
it has a button name as "Finish" when clicked calls "onFinishing"
Method.
onFinishing: function () {
var loadedPrefix = MyNamespace.loadedPrefix;
var inputBoxPrefix = $('#SitePrefix').val();
$.ajax({
type: 'POST',
url: '/Settings/IsPrefixExists',
data: { newPrefix: inputBoxPrefix, prefixLoadedFromDB: loadedPrefix },
success: function (data) {
// do some stuff here
}
},
error: function () {
DisplayError('Failed to load the data.');
}
});
}
Now above works perfectly fine. But my manager wants me to have two button there. One as "Save" and another as "Submit". And clicking on each of them will perform a different action. But this plugin has only one "Finish" button. And it is getting generated via PlugIn's Javascript code. Can I somehow use JQuery/Javascript to have one more button there, and write some code against it.
JS FIDDLE SAMPLE: JS FIDDLE SAMPLE
I want something like below Image 2:
SAMPLE Example: JS FIDDLE
Regardless of using the steps plugin, you can add a save button on the last step and bind a click handler like you would with any normal button:
and in your javascript:
You can also inject the button as needed.
Using the default plugin inside of a tag with and id of
#steps-uid-8
you can get the finish element with$('#steps-uid-8 a').last()
; It is nested inside of a<li>
which is inside of a<ul>
so you can get a reference to the ul$('#steps-uid-8 a').last(),parent().parent()
Using that reference you can add a hyperlink so your "button" has the same style as the plugin, like this:
You can also add a function in your settings to only show the Save button on the last step if you need to
Using your fiddle, the onload Javascript was simply changed.
Here is a working copy: https://jsfiddle.net/rwh64ja8/
Using the
onStepChanged
event found in the Steps plugin documentation...You could do this:
Updated JSFiddle