How do you convert a jQuery object into a string?

前端 未结 12 2031
臣服心动
臣服心动 2020-11-22 15:07

How do you convert a jQuery object into a string?

12条回答
  •  耶瑟儿~
    2020-11-22 15:41

    jQuery is up in here, so:

    jQuery.fn.goodOLauterHTML= function() {
        return $('').append( this.clone() ).html();
    }
    

    Return all that HTML stuff:

    $('div' /*elys with HTML text stuff that you want */ ).goodOLauterHTML(); // alerts tags and all
    

提交回复
热议问题