Article From:


<dd class="col-sm-11">
    <a href="">Beijing < /a>< a href= "" > Tianjin < /a>< a href= " "> Shanghai < /a>< a href= "" > Chongqing < /a></dd>

I want to extract all the links:

    $(function () {
        var hrefs = $('a').attr("href");


The browser console doesn’t show anything. How can I print it?

Answer 0:
 $('.col-sm-11 a').each(function(i,e){

Answer 1:

It should be a hit.
jqueryThe value of the first DOM will only be acquired when the DOM array is selected.
So go through the output.

Leave a Reply

Your email address will not be published. Required fields are marked *