0

Im looking to recreate the following button after updating to the latest version (button widget was rewritten in 1.12 onwards, However im struggling to get the syntax/classes correct based of the api documentation here: https://api.jqueryui.com/button/

button should look like Image of blue button with text new

but so far the closest I've got isenter image description here

the code used to display the above is as follows

<button id="btnAddNew" type="button" title="New User Access" role="button" aria-disabled="false"></button>


    $("#btnAddNew").button({
    classes: {
        "ui-button": "ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary"
    },
    icons: {
        primary: "ui-icon-plus"
    },
    label: "New"
});

Can anyone point to where im going wrong?

2
  • On a side note you may want to move away from jQuery UI and look for an alternate library as the project itself hasn't been updated in years and appears to be dead or at least dying.
    – j08691
    Commented Sep 4, 2019 at 15:21
  • Yes I agree, I would normally migrate to bootstrap but I don't have that option just need to update the existing code to get it looking as before.
    – Mr.B
    Commented Sep 4, 2019 at 16:13

1 Answer 1

0

This seems to work without issue using Cupertino theme. I suspect that CSS is not loading for your script. I would check to ensure it's not getting 404 error or that no other Styling is conflicting.

$(function() {
  $("#btnAddNew").button({
    icons: {
      primary: "ui-icon-plus"
    },
    label: "New"
  });
});
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/cupertino/jquery-ui.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<button id="btnAddNew" type="button" title="New User Access" role="button" aria-disabled="false"></button>

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.