jquery val() contains()

后端 未结 5 1587
青春惊慌失措
青春惊慌失措 2021-02-18 17:40

I want to know if the textarea value contains a certain word. This is not working for me.

var value = $(\'#embedModal textarea\').val();
if($(value).contains(\'i         


        
5条回答
  •  庸人自扰
    2021-02-18 18:09

    You can do this as well:

    if($('#embedModal textarea:contains("iframe")').length > 0){
        //TODO: do stuff
    }
    

提交回复
热议问题