如何使用php条件语句向DOM元素添加/编辑输入标签或类的属性?

I'm creating a visual table reservation system and in order to signify that a certain table is booked, it will become disabled.

*the code is not done yet but I'm trying to figure out first how I can add properties using jQuery inside a php conditional statement**

php code:

<?php 
    include "php/dbconn.php";
    $sql = "SELECT id FROM place";
    $tables = mysqli_query($conn, $sql); 
    while ($tablesrow = mysqli_fetch_array($tables)) {
        $flag = false;

            #check muna kung walang schedule conflict
        $sql = "SELECT place FROM reservation WHERE status=0 AND (date='$date' AND starttime <= 
        '$endtime' AND endtime >='$starttime;')";
        $bookedresult = mysqli_query($conn, $sql);
        while ($bookedrow = mysqli_fetch_array($bookedresult)) {
            if ($bookedrow["place"] == $tablesrow["id"]) {
                $flag = true;
                // echo $bookedrow["place"];
            }
        }
        if (!$flag) {
            // echo "<option>" . $tablesrow["id"] . "</option>";
            echo "<script>";`

` Then the javascript inside (this is a continuation of php code) where I wish to add a disabled attribute to the input checkbox with id #tblc_1

$(window).load(function () {$('#tbl-c').attr('disabled', true);}); 

This is for the html checkbox

<div class="tbl-c-cont">
<div class="tbl-c tbl-c1">
    <span>
        <input type="checkbox" id="tblc_1" value="tblc_1" name="tbl_id[]">
    </span>
</div>
<div class="tbl-c tbl-c2 ">
    <span>
        <input type="checkbox" id="tblc_2" value="tblc_2" name="tbl_id[]">
    </span>
</div>

It doesn't work and I don't receive the achieved results.

As per your question you have written wrong selector here. it should be #tblc_1 instead of #tbl-c. check updated snippet below

$('#tblc_1').attr('disabled', true);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="tbl-c tbl-c1">
    <span>
        <input type="checkbox" id="tblc_1" value="tblc_1" name="tbl_id[]">
    </span>
</div>
<div class="tbl-c tbl-c2 ">
    <span>
        <input type="checkbox" id="tblc_2" value="tblc_2" name="tbl_id[]">
    </span>
</div>

</div>