JavaScript How to change jquery button icon change jquery button text,change jquery button color,jquery change

I have a button right this:

        <button type="submit" class="btn blue pull-right" id="RequestNewPwd">
           Submit <i class="m-icon-swapright m-icon-white"></i>
        </button>

With a text and an icon. I'm trying to change the text and the icon like via javascript like this:

            $("#RequestNewPwd").button({
                label: "Sent",
                icons: {
                    primary: "m-icon-swapleft  m-icon-white",
                }
            })

But it does not work. I also tried:

$("#RequestNewPwd").text('Submit <i class="m-icon-swapright m-icon-white"></i>');

And it prints the html code like text. This works:

$("#RequestNewPwd").text('Submit'); 

But I need to show also the icon. Could someone help me? Thank you!

Answer:1

As you are appending html,you need to use .html() instead of .text():

$("#RequestNewPwd").html('Submit <i class="m-icon-swapright m-icon-white"></i>');
Answer:2

I would like to set attrs to undefined from unit test, I tried few approaches and didn't get to set it to undefined. Below is my directive: angular.module('myApp').directive('someElement', function ()...

I would like to set attrs to undefined from unit test, I tried few approaches and didn't get to set it to undefined. Below is my directive: angular.module('myApp').directive('someElement', function ()...

I am just beginning to learn AJAX and have a very newb question. I am reading the book "AJAX & PHP: Building Responsive Web Applications" by Packt Publishing, Darie et al. Ch. 2, Page 50 shows ...

I am just beginning to learn AJAX and have a very newb question. I am reading the book "AJAX & PHP: Building Responsive Web Applications" by Packt Publishing, Darie et al. Ch. 2, Page 50 shows ...

In a canvas I created a 2d context. In that context... with a function... I'm able to create some 'circle objects'. Now, what I want, is to get the ImageData of a single circle object instead of the ...

In a canvas I created a 2d context. In that context... with a function... I'm able to create some 'circle objects'. Now, what I want, is to get the ImageData of a single circle object instead of the ...

Currently I am trying to pull videos from a youtube channel with youtube api and then using javascript to search and categorize it. I can get a search to work on an html table, but can't get it to ...

Currently I am trying to pull videos from a youtube channel with youtube api and then using javascript to search and categorize it. I can get a search to work on an html table, but can't get it to ...

  1. retrieving videos from icloud
  2. retrieving videos from iphone
  3. retrieving videos from facebook
  4. retrieving videos from snapchat
  5. retrieving videos on ipad
  6. retrieving deleted videos from android
  7. retrieving deleted videos from iphone
  8. retrieving deleted videos from samsung
  9. retrieving deleted videos from ipad
  10. retrieving deleted videos from samsung s7
  11. retrieving deleted videos from phone
  12. retrieving deleted videos from gopro
  13. retrieving deleted videos from sony handycam
  14. retrieving deleted videos from laptop
  15. retrieving deleted videos from samsung tablet
  16. retrieving deleted videos from galaxy note 4
  17. retrieving deleted videos from computer
  18. retrieving deleted videos from canon