开发者

locate and use src values contained within <li><img src=""></li> with PHP

Im trying to get the string value of an img tag that is contained within a li tag that I have in my code using javascript.

The goal is to get all of the text contained in the img tag. But clearly I don't understand how to go that deep. When I try, I

The format of the html that Im trying to extract is...

       <ol> 
         <li><img ......开发者_C百科/></li>
       </ol>

Using what appears below, I get [object] returned instead of a string. Any idea on how to get the actual value of the string?

<script> 
$(function() {
    $( "#selectable" ).selectable({
        stop: function() {
            var result = $( "#select-result" ).empty();
            $( ".ui-selected", this ).each(function() {
                var index = $( "#selectable li img" );
                result.append( " #" + ( index + 1 ) );
            });
        }
    });
});
</script>


For the image source, try

var src = index.attr('src');

You can get any other attributes in the same way.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜