How to test if a HTML body contains empty tags

后端 未结 2 1579
轮回少年
轮回少年 2021-01-28 02:25

I am using a text editor on certain form fields, TinyMCE. it works ok.

However the TinyMCE editor returns a HTML body tag for each field in the form. T

2条回答
  •  借酒劲吻你
    2021-01-28 03:18

    you can do it on the client side using jquery

    if($('').find('body').children().length < 1) {
      console.log('empty')
    } else {
      console.log('not empty');
    }
    

    you can validate and send appropriate response to the server

提交回复
热议问题