I have 10 text fields for numeric values, each has a checkbox for each check if the checkbox is checked, the text field The values entered must be converted into negative values and then have to be saved in the database. If checked again it should become positive.
& lt; Td> & Lt; Input type = "text" name = "or" square = "number" maximum length = "5"? & Gt; "Id =" or "/> db Input & lt; td & gt; & lt; input type = "text" name = "or4" class = "num" maxlength = "5" /> gt; db & lt; ; / Td> & lt; input type = "text" name = "or8" class = "number" maximum length = "5" /> gt; & lt; / td & gt; & Lt; td & gt; Input and DB for each text box & lt; Td> - & lt; input type = "checkbox" name = "orneg1" class = "check1" check box "id =" org "/>
& lt; td & gt; - & lt; input type = "Org2" class = "check2" /> gt; & lt; / td> & lt; td & gt; - & lt; input type = "checkbox" name = "org4" class = "Check 3" /> gt; & lt; / td> & lt; td & gt; - & lt; input type = "checkbox" name = "org8" class = "check4" / & gt; & lt; / Td> & lt; td & gt; - & lt; input type = "checkbox" name = "org5" class = "check5" /> & Lt; / Td>
This can work:
$ ('Input [type = checkbox]' '(app (' (i) ') (eq (' (i) ') (app ($ (this) .attr (' checked ') ==' check ') { Var inputText = $ ('input [type = text]: eq (' + i + ')' '; var inputValue = parseInt (inputText.val (), 10); if (input value> gt; 0) {inputValue = '- InputText.attr (' value ', input value);}});
Comments
Post a Comment