javascript jquery to check a checkbox if a number greate than 0 is inserted into a box -


i have 2 inputs, text , checkbox:

<input type="text" id="09_1" name="09_1" class="rounded"/> <input type="checkbox" checked id="h09_1" name="h09_1" class="rounded"/> 

the textbox 09_1 updated number jquery9result of database lookup) want change of input text trigger javascript function checks checkbox h09_1.

so like:

  $("#09_1").on("change", function (event) {             alert('test');          }); 

this alert not work not correct am. want check box rather alert.

the checking of checkbox must happen if number greater 0.

thanks in advance.

if code isn't firing, might try putting 'on' on document so:

$(document).on("change", "#09_1", function (event) {      if(!isnan(this.value)){             if(this.value > 0)               $('#h09_1').attr('checked','checked');            else                $('#h09_1').removeattr('checked');      } }); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -