Search results

Change caret icon in JavaScript (ES5) DropDownButton control

Dropdown arrow can be customized on popup open and close. It can be handled in beforeOpen and beforeClose event.

In the following example, the up arrow is updated on popup close and down arrow is updated on popup open using beforeOpen and beforeClose event by adding and removing e-caret-up class.


var items = [
        text: 'Cut'
        text: 'Copy'
        text: 'Paste'

var options = {
  items: items,
  beforeClose: function() {
     drpDownBtn.cssClass = '';
  beforeOpen: function() {
     drpDownBtn.cssClass = 'e-caret-up';

var drpDownBtn =  new ej.splitbuttons.DropDownButton(options);
<!DOCTYPE html><html lang="en"><head>
    <title>EJ2 DropDownButton</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Typescript UI Controls">
    <meta name="author" content="Syncfusion">
    <link href="//" rel="stylesheet">
    <link href="//" rel="stylesheet">
    <link href="//" rel="stylesheet">
    <link href="//" rel="stylesheet">
    <link href="styles.css" rel="stylesheet">
<script src="" type="text/javascript"></script>

    <div id="container">
        <button id="arrow">Clipboard</button>

var ele = document.getElementById('container');
if(ele) { = "visible";
<script src="index.js" type="text/javascript"></script>
#container {
    visibility: hidden;

#loader {
  color: #008cff;
  height: 40px;
  left: 45%;
  position: absolute;
  top: 45%;
  width: 30%;

.e-caret {
  transform: rotate(0deg);
  transition: transform 200ms ease-in-out;

.e-caret-up .e-caret {
  transform: rotate(180deg);

button {
  margin: 25px 5px 20px 20px;