开发者

getting paragraph value in jquery

开发者 https://www.devze.com 2023-01-07 04:00 出处:网络
how to get the value of this paragraph in jq开发者_运维技巧uery <p class=\"editableText\" id=\"$bid\">$content</p>

how to get the value of this paragraph in jq开发者_运维技巧uery

 <p class="editableText" id="$bid">$content</p>


$(document).ready(function(){
    $('p.editableText').each(function(){
      var content = $(this).val();
   });
});

is this a correct approach ?!


$('.editableText').html() if it contains inner html or $('.editableText').text() for plain text

.val() should be used for inputs with a value attribute.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号