Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the name of a button in jquery-steps

Tags:

jquery-steps

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

like image 524
Brampage Avatar asked Mar 09 '14 17:03

Brampage


People also ask

How do I change the text of a button in jQuery?

Answer: Use the jQuery prop() and html() Methods You can simply use the jQuery prop() method to change the text of the buttons built using the HTML <input> element, whereas to change the text of the buttons which are created using the <button> element you can use the html() method.

How to change an HTML element name using jQuery?

- GeeksforGeeks How to change an HTML element name using jQuery ? Given an HTML document and the task is to replace an HTML element by another element. For example: we can change an element <b> with <h1> element without changing any other property. Select the HTML element which need to be change.

How to replace an HTML element by another element in JavaScript?

Given an HTML document and the task is to replace an HTML element by another element. For example: we can change an element <b> with <h1> element without changing any other property. Select the HTML element which need to be change. Copy all attributes of previous element in an object.

How do I select a button element in HTML?

The :button selector selects button elements, and input elements with type=button. Tip: Using input:button as a selector will not select the button element.


2 Answers

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);`
like image 65
Rafael Staib Avatar answered Sep 24 '22 09:09

Rafael Staib


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');
 }
like image 37
mirosz Avatar answered Sep 22 '22 09:09

mirosz