JSFiddle - React, Tailwind, and code Playground

HTML

<p>
    <input id="a" type="text" style="width: 250px" />
    </p>
    <p>
    <input id="b" type="text" style="width: 250px" placeholder/>
    </p>    <p>
    <input id="c" type="text" style="width: 250px" placeholder=""/>
    </p>    <p>
    <input id="d" type="text" style="width: 250px" placeholder="test"/>
    </p>

JavaScript

$.fn.hasAttr = function (attr) {
    var attribVal = this.attr(attr);
    return (attribVal !== undefined) && (attribVal !== false);
    //return !!this.filter('[' + attr + ']').length;
};

$('#a').val($('#a').hasAttr('placeholder'));
$('#b').val($('#b').hasAttr('placeholder'));
$('#c').val($('#c').hasAttr('placeholder'));
$('#d').val($('#d').hasAttr('placeholder'));