What is the method for customizing the color of the surrounding area near the next and previous arrows on a

I'm looking to customize the datepicker arrows in my UI. Specifically, I want to change the color surrounding the arrows and alter the arrow style itself:

https://i.sstatic.net/5y0UZ.png

I've been working with a downloaded jQuery UI CSS file that uses images from the "images" folder to style the "prev" and "next" buttons:

To achieve the desired effect, I edited the URLs in the jQuery-ui.css file to replace the yellow arrow images with blue ones. I modified lines like this:

.ui-icon,
.ui-widget-content .ui-icon {
    background-image: url("images/ui-icons_228ef1_256x240.png");
}

I also attempted to directly change the arrow icons using custom CSS:

.ui-datepicker-prev span {
    background-image: url(https://cdn0.iconfinder.com/data/icons/flat-round-arrow-arrow-head/512/Red_Arrow_Right-512.png) !important;
        background-position: 0px 0px !important;
}

.ui-datepicker-next span {
    background-image: url(https://cdn0.iconfinder.com/data/icons/flat-round-arrow-arrow-head/512/Red_Arrow_Right-512.png) !important;
        background-position: 0px 0px !important;
}

Unfortunately, my attempts resulted in the icons disappearing altogether.

I also tried to change the light pink color around the buttons (color code: #fef9e2), but couldn't locate it in any of the CSS files I searched through.

In an effort to keep things simple, I created a basic HTML structure to update the arrow buttons:

<html>
<head>
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> 
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script>
$(document).ready(function(){
$( "#datepicker" ).datepicker();
});  
  </script>
  
  <style>
.ui-widget-header .ui-icon {
background-image: url("https://cdn0.iconfinder.com/data/icons/flat-round-arrow-arrow-head/512/Red_Arrow_Right-512.png");
}
  </style>
</head>

<body>
<input type = "text" id = "datepicker">
</body>
</html>

My questions are:

  1. How can I change the button icons using an external link or by downloading an image for the jQuery date picker calendar buttons?

  2. What is the best way to style the light pink space around the buttons?

Answer №1

I have corrected the size, position, and rotation of the arrows. It seems like you are referring to the outline on focus with that pink color, so I have removed it.

$(document).ready(function() {
  $("#datepicker").datepicker();
});
<html>

<head>
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
    <script>
        $(document).ready(function() {
            $("#datepicker").datepicker();
        });
    </script>

    <style>
        .ui-datepicker-prev span.ui-icon,
        .ui-datepicker-next span.ui-icon {
            background-image: url("https://cdn0.iconfinder.com/data/icons/flat-round-arrow-arrow-head/512/Red_Arrow_Right-512.png");
            background-size: contain;
            background-position: center;
        }
        
        .ui-datepicker-prev span.ui-icon {
            transform: rotate(180deg);
        }
        
        .ui-datepicker-prev span.ui-icon:focus,
        .ui-datepicker-next span.ui-icon:focus {
            outline: none !important;
        }
    </style>
</head>

<body>
    <input type="text" id="datepicker">
</body>

</html>

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

Steps for opening a modal in a react native application when a button is clicked

Exploring the realm of react native, I face a challenge in triggering a modal on button click. I've attempted to implement the following code snippet to achieve this goal:- openHeaderModal = () => { <ModalDropdown options={["H1", "H ...

ajax id must be defined and not undefined

I have some code that is not working properly. In barang.php, the following code is present: barang.php <?php $p=isset($_GET['act'])?$_GET['act']:null; switch($p) { default : echo '': break; case " ...

RxJs Subject is failing to activate subscriptions in the production environment, however, it functions properly in development and testing

After successfully deploying our Angular app to our test server, my team encountered an issue when trying to deploy it to the production server. While the app functions correctly in development and on the test server, the subjects are not triggering their ...

Using an API to fetch a nested array for displaying data in an HTML table

I'm currently developing a program to retrieve and display data from the OpenSky-network API. The API returns an array of airplane information arrays, and I am looking for a way to present this information in an HTML table. Specifically, I want to ext ...

What is the method for incorporating a variable in MapReduce?

I have the following MapReduce script that I'm working with: splitAndGroupServices = function(groupMembers) { var mapFunction = function() { for(var idx in this.services) { var service = this.services[idx]; if(service.mem ...

Steps for creating a jQuery function that responds to changes in a text box value

Currently, I have a text box containing certain values and a submit button alongside a slider. When I click the submit button, the slider changes. However, I would like to achieve the functionality where instead of clicking the submit button, changing the ...

Automatically submit HTML form data as a JSON object to an API endpoint

I am working on incorporating an online form from Formstack onto a website, and the form's code is in HTML. However, I am seeking assistance in configuring it so that whenever a user submits information through the form, it will automatically send me ...

Extract information from one class and pass it to another class's data-value using jQuery

Currently, I am encountering an issue with JQuery data retrieval directly from the User. My goal is to extract the value from one class and assign it to another class as data-value. Here is a brief outline of my structure - https://i.sstatic.net/kEatS.jpg ...

Angular HTML layout designed for seamless interaction

<div class ="row"> <div class ="col-md-6"> Xyz </div> <div class ="col-md-6"> Abc </div> </div> Using the code above, I can easily create a layout with two columns. Th ...

Transforming JavaScript information into PHP with ajax for WordPress plugin creation

I'm currently navigating the realm of creating my inaugural WordPress plugin and encountering a hurdle in transposing a Javascript array of objects into PHP. My aim is to utilize this data to craft individual tables within the wp-admin user interface. ...

Issues with AJAX requests failing to fire with the latest version of jQuery

A small script I have checks the availability of a username in the database, displaying "taken" if it's already taken and "available" if it's not. The code below works perfectly with jQuery v1.7.2. However, I need to update it for jQuery v3.2.1. ...

What is the best way to ensure that an anchor in a scrolling list adjusts its width based on its children's content?

Check out the setup I have here: http://jsfiddle.net/9F6CF/ In this scenario, there is a list containing anchors within each list item. The UL element has a specific width and an overflow set to auto, causing text in the anchors to scroll horizontally if ...

I noticed that when using Next.js with the `revalidate: 1` option on a static page, it is triggering two full F5 refresh actions instead of just one. I was hoping for

Currently, I have set up a blog post edit page in my Next.js project. The post pages are utilizing the Incremental Static Regeneration feature with a revalidation time of 1 second for testing purposes. In the future, I plan to increase this to a revalidat ...

Discovering a specific string amidst two other strings across multiple lines in php

Having the source code of an old website with significant javascript arrays to retrieve, the task seems daunting for manual extraction. The data now needs to be integrated into a database, prompting the idea of creating a parser in PHP to gather the data i ...

What is the best way to implement iscroll4 in an iPad2 using CSS?

<html> <head> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/iscroll.js"></script> <script type="text/javascript" src="js/jquery-ui.min.js"></script> ...

How can we ensure successful validation using Jquery?

I'm currently working on a basic form that includes text fields. Whenever these text fields are modified, an Ajax function is called to save the changes. However, I am facing a challenge in validating these fields using jQuery before the change even ...

What could be causing the failure of this web component using shadow DOM when the HTML code includes multiple instances of the component?

Recently, a question was raised on this platform regarding the use of Selenium to access the shadow DOM. Curious about this topic, I delved into the MDN article Using shadow DOM and decided to replicate the code on my local machine. Surprisingly, it worked ...

enclosing text in a div container in WordPress

My WordPress website is built on the Bootstrap framework and includes content with images and text. I'm attempting to encase the text content in row and col-md-10 tags, while leaving the images as they are. This content is pulled into my single.php p ...

Issue with Bootstrap JQUERY Plugin in External Modal

product.php <a data-toggle="modal" data-target="#quick_edit" href="quick_edit.php?productid=<?php print $row['productid'];?>" class="btn btn-xs btn-success"><i class="fa fa-share"></i></a> <div class="modal" id= ...

Guide on applying CSS to option tag within a select element in VUE.js

I am attempting to design a dropdown menu that resembles the one shown in the image. However, I'm currently unable to include any CSS styling. Can anyone provide guidance on how to create a customizable select dropdown in Vue? https://i.stack.imgur.c ...