次のコードでhtml
マークアップを自分に入れようとしていますarray
//my htmlData which is entered by user so it could be varies.
<em>test</em> here for the testing purpose
second line <strong>texts</strong> here
array
を使用して保存したい
var data = [];
$(htmlData).contents().each(function(){
data.push($(this).html().trim());
}
しかし、私はエラーが発生しましたUncaught TypeError: Cannot call method 'trim' of null.
$(this).html()
を返す理由がわからないnull
。
誰でもここで私を助けることができますか? どうもありがとう!