Changing the name of a button in jquery-steps
Asked Answered
M

4

13

I have included the jquery-steps plugin. How can I change the buttons texts?
Now it says "finish" I want to change that into "go"

Thanks

Minerva answered 9/3, 2014 at 17:52 Comment(0)
C
33

Check out the following link. You can change all labels on initialization.

var settings = {
    labels: {
        current: "current step:",
        pagination: "Pagination",
        finish: "Finish",
        next: "Next",
        previous: "Previous",
        loading: "Loading ..."
    }
};
$("#wizard").steps(settings);`
Clod answered 11/3, 2014 at 13:50 Comment(0)
S
5

I just needed to change button text depending on condition. And it can be done without changing settings just like that

 if(true){
 $('a[href$="finish"]').text('Go');
 }else{
 $('a[href$="finish"]').text('No Go');
 }
Splutter answered 26/4, 2017 at 9:40 Comment(0)
M
4

You can do this:

form.steps({
    headerTag: "h4",
    bodyTag: "section",
    transitionEffect: "fade",
    labels: 
    {
        finish: "Go",
    },
    onStepChanging: function (event, currentIndex, newIndex)
    {       
        //change color of the Go button
        $('.actions > ul > li:last-child a').css('background-color', '#f89406');
        form.validate().settings.ignore = ":disabled";
        return form.valid();
    },      
    onFinishing: function (event, currentIndex)
    {
        form.validate().settings.ignore = ":disabled";
        return form.valid();
    },
    onFinished: function (event, currentIndex)
    {

        form.submit();  
    }
});
Manifestation answered 30/10, 2015 at 2:21 Comment(0)
O
1

If the label / text of the buttons should change dynamically depending on the language, you can use this:

/* dynamic change prev-next button text language (check lang attribute in html tag) */

var language = $('html').attr('lang');

$(window).on('load', function () {
  if(language != 'de'){
    $('a[href$="next"]').text('Next');
  } else {
    $('a[href$="next"]').text('Weiter');
  }
});
Outdistance answered 18/9, 2019 at 12:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.