jquery 遍历dom节点
jquery 遍历dom节点
实例
$('#answer_' + id).find('li.answer-list').each(function (i, li) { var $li = $(li); var $div = $li.find('>div'); var $answerDiv = $div.find('>div'); var answerContent = $answerDiv.html(); var limit = 300;//字符限制 if (answerContent && answerContent.length > limit) { com.whuang.hsj.setCustomAttr($answerDiv.get(0), 'originalVal', answerContent); answerContent = omitTooLongString(answerContent, limit, true); $answerDiv.html(answerContent); console.warn('超长'); $div.find('ul.operate-list').append('<li> <a href="javascript:showAllAnswer(\'' + $answerDiv.attr('id') + '\')">显示全部</a> </li>'); } // console.log(answerContent) })
相关推荐
zrtlin 2020-11-09
xuebingnan 2020-11-05
wikiwater 2020-10-27
heheeheh 2020-10-19
Crazyshark 2020-09-15
softwear 2020-08-21
ZGCdemo 2020-08-16
jczwilliam 2020-08-16
littleFatty 2020-08-16
idning 2020-08-03
jinxiutong 2020-07-26
lanzhusiyu 2020-07-19
Skyline 2020-07-04
xiaofanguan 2020-06-25
Aveiox 2020-06-23
dragonzht 2020-06-17