JSFiddle - React, Tailwind, and code Playground

by Gerald Gillespie

HTML

<div><a href="test.php"></a><a href="//site/test.php"></a><a href="https://secure/test.php"></a>

    <textarea id="log" rows=40 cols=50></textarea>
</div>

JavaScript

var $what = $('a'),
    log = '';

// quick example of looking at the property on the first item in the collection
$('#log').before('href property of first item in the collection: ' + $what.prop('href'));


//looping on collection.  
$what.each(function () {
    var $this = $(this);
    log += '\nelement: ';
    log += $this.clone().wrap('<div/>').parent().html();
    log += '\nproperty: ';
    log += $this.prop('href'); // jquery way to get interpreted property
    log += '\nattribute: ';
    log += $this.attr('href'); // jquery way to get succinct attribute
    log += '\n------\n\n';
});

$('#log').val(log);