第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何獲取jquery的html()方法剛生成內(nèi)容的屬性?

如何獲取jquery的html()方法剛生成內(nèi)容的屬性?

動漫人物 2018-08-17 10:10:22
有一段古董代碼  var readHtml = '<p class="p-recipients recipients-css"><span>收件人: </span><span id="recipients-all">' + str + '</span></p>';     readHtml += '<span class="launch-css"><span id="view_user" class="ui-icon ui-icon-arrow-d ui-icon-shadow">&nbsp;</span></span>'     $('#reader').html(readHtml);我現(xiàn)在想要獲取生成文字的寬度,嘗試代碼如下:結(jié)果獲得的結(jié)果全部都是0。但在瀏覽器的console中能獲取到正確的值。已經(jīng)試過$('#reader').ready(function() {}了,并沒有好轉(zhuǎn)。不知道有什么辦法能獲取到剛插入內(nèi)容的寬度
查看完整描述

1 回答

?
隔江千里

TA貢獻1906條經(jīng)驗 獲得超10個贊

setTimeout(function(){
    console.log($('#recipients-all').prev());
    console.log($('#recipients-all'));
    var scorllWidth = $('#recipients-all').prev()[0].offsetWidth + $('#recipients-all')[0].offsetWidth;
    console.log(scorllWidth);
    console.log($('#reader')[0].offsetWidth);},0);


查看完整回答
反對 回復 2018-09-28
  • 1 回答
  • 0 關(guān)注
  • 820 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號