Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
Select / Deselect All Checkboxes using jQuery in Thymeleaf

I am trying to add the function of selecting and deselecting all fields. What I have now doesn't work for me and I don't know why? Does anyone know why?

.....
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://igoradamenko.github.io/awsm.css/css/awsm.min.css">
    <script src="https://code.jquery.com/jquery-3.5.0.js"></script>
    <title>Report</title>
    <script>
        $("#selectAll").click(function() {
            $("input[type=checkbox]").prop("checked", $(this).prop("checked"));
        });
    </script>
</head>
....

 <label for='selectAll'><input id="selectAll" type="checkbox">Select All </label>
            <input checked="checked" type="checkbox">Test</label>
            <label th:each="item : ${userConfig.isEnableMap}">
                <input checked="checked" type="checkbox" th:text="${item.key}" th:field="*{isEnableMap['__${item.key}__']}"/>
            </label>

I added changes and it works now

<script>
    $(document).ready(function () {
        $("#selectAll").change(function () {
            $("input:checkbox").prop('checked', $(this).prop("checked"));
        });
    });
</script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can try :

$("input[type=checkbox]").prop("checked",true);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!