开发者

Determine if a string contains any specified values

开发者 https://www.devze.com 2022-12-22 16:11 出处:网络
Is it possible to do something like the following in jQuery: if($(\'UploadField\').val().contains(\'.gif\',\'.jpeg\'开发者_JS百科,\'.jpg\',\'.png\'))

Is it possible to do something like the following in jQuery:

if($('UploadField').val().contains('.gif','.jpeg'开发者_JS百科,'.jpg','.png'))
{

}

...checking for an array of values?


if ($('UploadField').val().match(/\.(gif|jpeg|jpg|png)/))
{

}

should work

0

精彩评论

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

关注公众号