jQuery - selectors on a html string

后端 未结 4 756
野的像风
野的像风 2020-12-14 15:36

I am going to get a element from a html-string with jQuery, but I always get an undefined in my console. My String is:

asd         


        
4条回答
  •  温柔的废话
    2020-12-14 16:03

    I have a response that is of the form:

    ...
    ...
    ...

    And @minitech 's method resulted in an array of HTML nodes in which the selector didn't work.

    So I tried this and it worked out nice:

    $.ajax({
        url:
        success: function($data) {
             var $parsed_data = $('
    ').append($data); var found = $parsed_data.find(".Selector"); ... } });

提交回复
热议问题