User interface modal dialog box with a close icon that changes color

Having trouble fixing the color of ui-icon-close, the close icon "X"? I've been referring to this page How To Specify (Override) JQuery Icon Color for help on changing the color of ".ui-close-icon" but it hasn't worked. Any suggestions on how to solve this?

Check out my JS fiddle.

https://jsfiddle.net/kimihiro/hqxmmj8q/show/ https://i.sstatic.net/UcxH5.jpg

$.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
  _title: function(title) {
    if (!this.options.title) {
      title.html(" ");
    } else {
      title.html(this.options.title);
    }
  }
}));
$("#dialog").dialog({
  autoOpen: false,
    height: 300,
  width: 830,
  dialogClass: 'myTitleClass',
  modal: true,

  title: "Carpe Diem. Nunca Acredito Posteiro",
  closeOnEscape: false,
  open: function(event, ui) {
    $('.ui-dialog-titlebar-close', ui.dialog | ui);
  },
  buttons: {
    "Save": function() {
      $(this).trigger(updateKeyword());
    }
  }
})

$("#opener").click(function() {
  $("#dialog").dialog("open");
});
input#opener {
   height: 30px;
   width: 200px;
   left: 50%;
   margin-top: -15px;
   /* = -height / 2   */
   margin-left: -100px;
   /* = -width / 2    */
   position: fixed;
   top: 80%;
   background: rgba(4, 115, 184, 0.9);
   color: #fff;
   font-style: Arial;
   font-size: 16px;
   font-weight: 700;
   line-height: 1.5;
   border-style: outset;
   display: flex;
   transition: .5s ease;
   vertical-align: middle;
   justify-content: center;
 }
 
 .myTitleClass .ui-dialog-title {
   white-space: normal;
 }
 
 .myTitleClass .ui-dialog-titlebar {
   background: rgba(4, 115, 184, 0.9);
   color: #fff;
   font-size: 16px;
   font-weight: 700;
   height: 60px;
 }
 
 .myTitleClass .ui-widget-content .ui-state-default {
   background-image: none;
   background-color: rgba(4, 115, 184, 0.6);
   color: #fff;
   font-size: 16px;
   font-weight: 700;
   border-style: none;
 }
 
 ... (remaining code continues)
<script type="text/javascript" src="jsapi/utils.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

... (remaining code continues)

Answer №1

To customize the icons, use the following CSS:

.ui-state-default .ui-icon {
    background-image: url(http://download.jqueryui.com/themeroller/images/ui-icons_ffffff_256x240.png) !important;
}

You can choose any color for the icon by modifying the color part in the URL:

http://download.jqueryui.com/themeroller/images/ui-icons_*COLOR*_256x240.png

COLOR - Change the color code to your desired color like ff0000, ffffff

(Please avoid using the URL as a CDN, it's recommended to save the files locally)

$.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
  _title: function(title) {
    if (!this.options.title) {
      title.html("&#160;");
    } else {
      title.html(this.options.title);
    }
  }
}));
$("#dialog").dialog({
  autoOpen: false,
    height: 300,
  width: 830,
  dialogClass: 'myTitleClass',
  modal: true,

  title: "Carpe Diem. Nunca Acredito Posteiro",
  closeOnEscape: false,
  open: function(event, ui) {
    $('.ui-dialog-titlebar-close', ui.dialog | ui);
  },
  buttons: {
    "Save": function() {
      $(this).trigger(updateKeyword());
    }
  }
})

$("#opener").click(function() {
  $("#dialog").dialog("open");
});
.ui-state-default .ui-icon {
    background-image: url(http://download.jqueryui.com/themeroller/images/ui-icons_ffffff_256x240.png) !important;
}

input#opener {
   height: 30px;
   width: 200px;
   left: 50%;
   margin-top: -15px;
   /* = -height / 2   */
   margin-left: -100px;
   /* = -width / 2    */
   position: fixed;
   top: 80%;
   background: rgba(4, 115, 184, 0.9);
   color: #fff;
   font-style: Arial;
   font-size: 16px;
   font-weight: 700;
   line-height: 1.5;
   border-style: outset;
   display: flex;
   transition: .5s ease;
   vertical-align: middle;
   justify-content: center;
 }
 
 .myTitleClass .ui-dialog-title {
   white-space: normal;
 }
 
 .myTitleClass .ui-dialog-titlebar {
   background: rgba(4, 115, 184, 0.9);
   color: #fff;
   font-size: 16px;
   font-weight: 700;
   height: 60px;
 }
 
 .myTitleClass .ui-widget-content .ui-state-default {
   background-image: none;
   background-color: rgba(4, 115, 184, 0.6);
   color: #fff;
   font-size: 16px;
   font-weight: 700;
   border-style: none;
 }
 
 .myTitleClass .ui-widget-content .ui-state-hover {
   background-image: none;
   background-color: rgb(4, 127, 184);
   color: #fff;
   font-size: 16px;
   font-weight: 700;
   border-style: none;
 }
 
 .ui-widget-overlay {
   position: fixed;
   background: black;
 }
 
 .myTitleClass .ui-dialog-titlebar-close {
   background: rgba(4, 115, 184, 0.9);
   border-radius: 17px;
   height: 33px;
   margin: -10px 0 0;
   padding: 1px;
   position: absolute;
   right: -28px;
   top: -24%;
   width: 33px;
 }
 
 .myTitleClass.ui-icon-close {
   background-image: url("images/ui-icons_ffffff_256x240.png");
 }
 
 .ui-dialog {
   overflow: visible;
 }
<script type="text/javascript" src="jsapi/utils.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<input type="button" id="opener" value="Register Keyword">
</button>
<div id="dialog">Merry Christmas.
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

the ajax method is not being executed

My specific requirement is to retrieve values returned from my aspx page in an HTML page. Thank you in advance for your assistance. <script type="text/javascript"> function getCars() { alert("Hello"); $.ajax({ type: "POST", ...

Is there a way for my script to interpret a subscripted output as a predefined variable name?

Is there a way to make the output of my string be interpreted as a variable rather than displayed as text? Despite researching the issue, I am struggling to find a solution as a beginner in this subject. } function showDetailedView(currentDiv) { var ...

problem arises due to node.js not functioning correctly

Being new to server-side scripting, I decided to give it a try with a file called "hellonode.js". Unfortunately, whenever I try to launch this file, I encounter an issue. I use node and attempt to access the file within a folder named new This results in ...

What are some creative ways to customize the appearance of the RangeFilter in django

Need help styling a range input issue. Currently, I am using the django_filters.RangeFilter class to declare my filter: parent__length = django_filters.RangeFilter(label="Length") The current display is shown in this image: https://i.sstatic.ne ...

Utilize Jquery to toggle text input forms based on radio button selections

I have a group of text inputs labeled with the class 'bankinput'. Alongside them, I have two radio buttons generated by asp.net helpers. The ids assigned to these radio buttons in the generated html are 'Cheque' and 'Draft'. F ...

Implement the insertion of JSON items in real-time by leveraging the power of Angular JS and

I'm facing a challenge trying to insert JSON items into a dynamic list: The structure of my JSON file is as follows: [ { "id":"34", "City":"New York", "Country":"USA" }, { "id":"22", "City":"Las vegas", "Country":"USA" }, { "id":"44", "City":"Paris" ...

Contrasting the use of creating a new Promise and using Promise.resolve

Looking to gain insight into how the NodeJS runtime manages things in the code snippet below: const billion = 1000000000; function longRunningTask(){ let i = 0; while (i <= billion) i++; console.log(`Billion loops done.`); } function lon ...

Tips for creating a custom cursor

I'm currently working on a class that is responsible for changing the mouse cursor when it hovers over a specific element. It requires a string parameter, which is the relative path to my custom cursor file (it's a .png file). However, upon runni ...

The problem of OAuth redirect URIs in Facebook login with ReactJS

I am currently in the process of integrating Facebook login by referring to and https://www.npmjs.com/package/react-facebook-login The issue I am encountering is... If a Facebook account is not logged in on the browser, clicking the Facebook login bu ...

Executing a function before changing routes and then changing the route once the function is completed

I am curious about how to call a function when clicking on: <Link to="/">page</Link> and invoke a function before the route changes. For example, When I am in component A and click on a link to go to Component B, I want to trigger a JavaScr ...

Unsure of how to create a record of calculations made on the calculator

I am struggling with creating a calculator that includes a history feature. I have the basic functioning of the calculator working, but now I want to modify it so that it displays a history of operations performed by the user. The goal is for the history t ...

Loop through each object in an array and verify if the value matches a specific criteria in Javascript

Explore the common issues related to object iteration and queries outlined below. Presented here is a list of objects (used for managing a connection form): const connectionData = { mail: { value: false, isRequired: true }, password: { v ...

What is the process for consumers to provide constructor parameters in Angular 2?

Is it possible to modify the field of a component instance? Let's consider an example in test.component.ts: @Component({ selector: 'test', }) export class TestComponent { @Input() temp; temp2; constructor(arg) { ...

What is the best way to verify reCAPTCHA v2 on an HTML website?

The code I'm using is giving me an error when the page loads: Cannot connect to reCAPTCHA. Please check your connection and try again. Just a reminder, I won't be incorporating any server-side code on my website. It's a simple HTML setup ...

Is it possible to run a php file through jquery without using the post or get method?

I am currently working on developing a unique contact content manager using HTML, CSS, PHP, mySQL, and jQuery to add dynamic features. After submitting the login form, the $_REQUEST is sent to connection.php. Upon successful authentication, JSON data is r ...

Troubleshooting state issues with Vuex and Firebase

Within my vuex store, I have a setup where users are authenticated using Firebase. After logging in, the firebase.auth().onAuthStateChanged function is triggered, setting the user variable to state.user and saving it in the Firebase database. However, when ...

The webpage encountered an error while attempting to load a resource: server reported a 404 (Not Found) status for jquery-1.7.1.min.js

I am currently in the process of creating an asp.net web application. For my project, I have included jquery-1.7.1.min.js using the code snippet below: <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> However, upon testing, ...

Is it possible to avoid passing each individual Vue prop by destructuring them?

Essentially, I am working with a component <Device> v-for="device in devices" :key="device.name" :device="device" :name="device.name" :number="device.number" :type="device.type" :status=&qu ...

The error "navigator.permissions.query is not a defined object" is encountered in the evaluation

Whenever I try to access my website on an iPhone 7, I encounter a frustrating error. The main screen loads without any issues, but as soon as I click on something, a white bank screen appears. I believe this piece of code might be the cause: useEffect( ...

Mask the "null" data in JSON

I'm currently working with a JSON file and trying to display it in a bootstrap table. Check out the code snippet I've been using: $(document).ready(function(){ $.getJSON(url, function(data){ content = '<h1><p class="p1 ...