JSFiddle - React, Tailwind, and code Playground
HTML
<div class = 'div_test'>
<div class="checkbox">
<input type="checkbox" id="id_chxbox" name="" value="">
<label for="id_chxbox"><span>Checkbox 1 </span> <span class='detail_view'> [detail] </span></label>
</div>
</div>
CSS
.checkbox input[type="checkbox"] {
width: auto;
opacity: 0.00000001;
position: absolute;
left: 0;
margin-left: -20px;
}
.checkbox label {
position: relative;
}
.checkbox label:before {
content: '';
position: absolute;
left: 0;
top: 0;
margin: 4px;
width: 20px;
height: 20px;
transition: transform 0.28s ease;
border-radius: 3px;
border: 1px solid ;
}
.checkbox label:after {
content: '';
display: block;
width: 9px;
height: 4px;
border-bottom: 2px solid #7bbe72;
border-left: 2px solid #7bbe72;
-webkit-transform: rotate(-45deg) scale(0);
transform: rotate(-45deg) scale(0);
transition: transform ease 0.25s;
will-change: transform;
position: absolute;
top: 10px;
left: 9px;
}
.checkbox input[type="checkbox"]:checked ~ label::before {
color: #7bbe72;
}
.checkbox input[type="checkbox"]:checked ~ label::after {
-webkit-transform: rotate(-45deg) scale(1);
transform: rotate(-45deg) scale(1);
}
.checkbox label {
min-height: 30px;
display: block;
padding-left: 30px;
margin-bottom: 0;
font-weight: normal;
cursor: pointer;
vertical-align: sub;
font-size: 16px;
}
.checkbox label span {
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
.detail_view {
padding-left: 100px;
}
JavaScript
$('.div_test').on('click', 'span.detail_view', function () {
alert("text");
});