javascript - When the checkbox is checked, insert numbering on table td -
<td> <apex:inputfield value="{!child.confirm_order__c}" /> </td> //checkbox <td> <!-- <apex:panelgroup rendered="{!child.confirm_order__c==true}">--> <apex:inputfield value="{!child.order_numbering__c}" id="getindex" /> //text field <!-- </apex:panelgroup>--> </td> <apex:commandbutton value="save" action="{!save}" onclick="insert_numbers()" />
html:
<table> <th><td>checkbox value</td><td>inputfield value</td></th> <tr> <td>true</td><td>1</td> <td>false</td><td></td> </tr> <tr> <td>true</td><td>2</td> <td>false</td><td></td> </tr> </table>
javascript :
<script> function insert_numbers() { $("[id$=getindex]").each(function(index) { $(this).val(index + 1) }) } </script>
currently working fine. inserts number every td.
i want modify in such way when checkbox checked, numbers inserted in input field td 1, 2, 3... (i want insert number td checkbox checked .remaining blank)
(or)
i won't show input field td whenever checkbox not checked. want number td input field visible.
currently not inserting if td not avaliable in middle of row.
how can this?
Comments
Post a Comment