Set the disabled state

17 Feb 20223 minutes to read

Disable the TextBox by adding the e-disabled to the input parent element and set disabled attribute to the input element.

<div class="control-section">
    <div class="control_wrapper accordion-control-section">
        <input class="e-input" type="text" placeholder="Enter Name" disabled />

        <div class="e-float-input e-disabled">
            <input type='text' required disabled />
            <span class="e-float-line"></span>
            <label class="e-float-text">Enter Name</label>
        </div>
    </div>
</div>
<script>
    ej.base.enableRipple(true);

    // To get the all input fields and its container.

    var inputElement = document.querySelectorAll('.e-input-group .e-input,.e-float-input.e-input-group input');

    // Add 'e-input-focus' class to the input for achive ripple effect when focus on the input field.

    for (var i = 0; i < inputElement.length; i++) {
        inputElement[i].addEventListener('focus', function () {
            var parentElement = this.parentNode;
            if (parentElement.classList.contains('e-input-in-wrap')) {
                parentElement.parentNode.classList.add('e-input-focus');
            } else {
                this.parentNode.classList.add('e-input-focus');
            }
        });
        inputElement[i].addEventListener('blur', function () {
            var parentElement = this.parentNode;
            if (parentElement.classList.contains('e-input-in-wrap')) {
                parentElement.parentNode.classList.remove('e-input-focus');
            } else {
                this.parentNode.classList.remove('e-input-focus');
            }
        });
    }
</script>
public ActionResult Index()
{
    return View();
}