-->

Javascript for enable and dissable td in table

2019-08-30 16:10发布

问题:

I have three td for cost field in a grails project, I have added three cost like 300, 400, 500 in individual td and I have jeditable for editing each td and adding someother value for it by submitting it, that value will get added to the database, my problem is, I clicked three td simultaneously and edited the the first value for example 300 to 600 and clicked the submit button but the edited value 600 gets updated to all other td like 400 to 600 and 500 to 600, what I need is a javascript function for disabling other td's when one is clicked for edition... thanks in advance

<tbody>
    <g:each in="${labServices}" status="i" var="labServiceInstance">
        <tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
            <td>
                ${fieldValue(bean: labServiceInstance, field: "testUnit")}
            </td>

            <td id="${labServiceInstance.id}" >
               ${fieldValue(bean: labServiceInstance, field: "cost")}
             </td>
        </tr>
    </g:each>
</tbody>