I want to disable the input text after the user clicks on another input tag with checkbox type,
The problem is that the date range input text is not disabled every time I click on the checkbox, can anyone help?
function myFunction() { document.getElementById("daterange").disabled = true; }
<div class="item form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="email">Date <span class="required">*</span> </label> <div class="col-md-6 col-sm-6 col-xs-12"> <input type="text" name="daterange" id="daterange" class="form-control date" placeholder="Choose multiple dates"> <p style="color: white"> <input type="checkbox" name="everyday" id="everyday" onclick="myFunction()" value="everyday" class="flat" /> Everyday </p> </div> </div>
edit: I just realized that when the page is not fully loaded it works as I expected, but if the page is fully loaded there seems to be something that prevents the functionality from working
Maybe you can try using alpineJS
in laravelIf you use laravel brezze, alpine JS is already included. We can easily manipulate our DOM without writing a lot of JS code. Just write in inline HTML