开发者

Select Box on change Not called for this Function

开发者 https://www.devze.com 2023-01-27 06:57 出处:网络
$(\'input[id*=id_]\').bind(\'change\',function(){ var num= $(this).parent().parent().children().first().html()*1;
$('input[id*=id_]').bind('change',function(){
var num= $(this).parent().parent().children().first().html()*1;
callfunc2(num);
});
  function callFunc2(num){
    if(num)>1{
      if ($('#id_select'开发者_运维问答+num).val()=='' &&
      $('#id_text1'+num).val()=='' && 
      $('#id_text2'+num).val()==''){
      validatenone();
     }else{
     vaidateall();
   }}}

So My Problem is Iam not able to call the Callfunc2() 

when i change or select another item in the Selectbox other than the default value.Now my Select box has an id of "id_select" prrefixed.And it is calling callfunc2() for textbox but not select bo what might be the reason


Your selector won't find <select> elements, you need to add those in there, like this:

$('input[id*=id_], select[id*=id_]').change(function(){
  var num= +$(this).parent().parent().children().first().html();
  callfunc2(num);
});

There are other syntax issues as well, if(num)>1{ should be if(num>1){, but the above selector issue is why it's not getting called at all.

0

精彩评论

暂无评论...
验证码 换一张
取 消