jquery判断字符串中是否存在某个的字符串

有两种方式:

1)test

2)indexOf

$(function(){
  var str="sunny,woo";
  var sear=new RegExp(',');
  if(sear.test(str)){
     alert('Yes');
  }
  var tag=',';
  if(str.indexOf(tag)!=-1){
     alert('Yes');
  }
  });