JSFiddle - React, Tailwind, and code Playground

by dmethvin

HTML

<a href="/">anchor with an href to /</a><br />
   <a>anchor with no href</a><br />
   <a href="" id="arf">anchor with explicit empty string href</a><br />
   <div id="results"></div>

JavaScript

// #4873

var empty_href_count_result     = "found " + jQuery("a[href='']").length + " anchors with empty hrefs";
var non_empty_href_count_result = "found " + jQuery("a[href!='']").length + " anchors with non-empty hrefs";
var non_empty_value_count_result = "found " + jQuery("input[value!='']").length + " inputs with non-empty values";
jQuery('#results').html(
    empty_href_count_result + "; " + 
    non_empty_href_count_result+"<br />"+
    "arf href="+$("#arf").attr("href")
);