Home > front end >  Using jQuery dynamic increase input box how to set up the limit value of the input box on the left t
Using jQuery dynamic increase input box how to set up the limit value of the input box on the left t

Time:09-24

HTML code

Weight range for the left border & lt;/th>
Weight range right border & lt;/th>

Js code
Let num=$(" # level_num "). Val ();
For (let n=0; N & lt; num; N++) {
Sort +=1;
Let newTr=document. The createElement method (' tr);
Let newTd=`
& lt; td>

CodePudding user response:

A id for each input, this HTML to the interface, $(" # set id "). The blur (function () {
//determine coordinates must be smaller than the right
})

CodePudding user response:

Is a great god, and add the id in the JS code input, I didn't write inside the HTML input, only & lt; Th>

CodePudding user response:

When you want to check in

CodePudding user response:

 $(document) on (" blur ", ". ActBerPos,. BerThgDir ", function (event) {
Var tr=$(this). The closest (" tr ");
Var a=parseFloat ($(". ActBerPos ", tr.) val ());
Var b=parseFloat ($(". BerThgDir ", tr.) val ());
if (! The isNaN (a) & amp; & ! The isNaN (b) & amp; & A>=b) {
Alert (" the left "+ a +" not less than the right "+ b);
}
});

CodePudding user response:

references 4 floor sky waves reply:
 $(document) on (" blur ", ". ActBerPos,. BerThgDir ", function (event) {
Var tr=$(this). The closest (" tr ");
Var a=parseFloat ($(". ActBerPos ", tr.) val ());
Var b=parseFloat ($(". BerThgDir ", tr.) val ());
if (! The isNaN (a) & amp; & ! The isNaN (b) & amp; & A>=b) {
Alert (" the left "+ a +" not less than the right "+ b);
}
});
thank you very much
  • Related