jQuery addClass example

Change class name on click in jQuery

by Dhanck

HTML

<div class="container">
  <div class="Filtering">
    <input type="text" placeholder="Enter text to filter">
    <span>Clear All Filters</span>
  </div>
  <div class="Filters">
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
    <div class="tag">Custom Tag</div>
  </div>
  <div class="main">
    <div class="lhs">
    <div class="select-all">
    <input type="checkbox"><span>Select All</span>
    </div>
      <ul class="main-list">
        <li><input type="checkbox"><span>Cover Page (Mandatory)</span></li>
        <li><input type="checkbox"><span>Disclosures (Mandatory)</span></li>
        <ul>
          <li class="list-section"><input type="checkbox"><span>Section 1 - Introduction</span></li>
          <li class=""><input type="checkbox">Midyear Outlook</li>
          <li class=""><input type="checkbox">Improving Investor Outcomes</li>
          <li class=""><input type="checkbox">Portfolio Construction Principles</li>
          <li class=""><input type="checkbox">Manager Selection Principles</li>
        </ul>
        <ul>
          <li class="list-section"><input type="checkbox"><span>Section 2 - Portfolio Summary</span></li>
          <li class=""><input type="checkbox">Portfolio Summary - Prosposed Holdings</li>
          <li class=""><input type="checkbox">Allocation Changes</li>
          <li class=""><input type="checkbox">Portfolio Stats, Average Annual Total Returns</li>
        </ul>
        <ul>
       ...

CSS

.container {
  width: 1000px;
  height: 800px;
  -webkit-box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.64);
  -moz-box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.64);
  box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.64);
  font-family: 'Arial';
}

.Filtering {
    height: 40px;
    border-bottom: 1px solid #afafaf;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    font-size: 12px;
}
.Filtering input{
  padding-left: 6px;
}
.Filters {
  height: 50px;
  border-bottom: 1px solid #afafaf;
}

.main {
  height: 100%;
}

.lhs {
  width: calc(70% - 1px);
  border-right: 1px solid #afafaf;
  float: left;
  height: calc(800px - 92px);
}

.rhs {
  width: 30%;
  float: left;
}

.header {
  background: #00aeef;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

ul.added-pages {
  list-style: none;
  margin-left: -20px;
  font-size: 14px;
  line-height: 18px;
}

ul.added-pages ul {
  list-style: none;
  margin-left: 20px;
  padding: 10px 0;
}

.item-section {
  font-weight: 600;
  margin-left: -20px;
}
.main-list {
   overflow: auto;
   height: calc(100% - 60px);
}

ul.main-list {
  list-style: none;
  margin-left: -20px;
  font-size: 14px;
}

.main-list ul {
  list-style: none;
  margin-left: -20px;
}

.main-list ul {
  margin-left: 20px;
}

.main-list .list-section {
  margin-left: -20px;
}

.main-list li {
  display: flex;
  align-items: center;
  line-height: 28px;
}
.select-all{
  display: flex;
  align-items: center;
  line-height: 28px;
  font-weight: 600;
  font-size: 15px;
  margin: 5px 0 0 10px;
}
.tag {
    border: 1px solid #dedede;
    float: left;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin: 2px 5px;
    cursor: pointer;
}



/* Scrollbar Style */
::-webkit-scrollbar {
  width: 14px;
  height: 18px;
}
::-webkit-scrollbar-thumb {
  height: 6px;
  border: 4px solid rgba(0, 0, 0, 0);
 ...