JSFiddle - React, Tailwind, and code Playground

by Sam Tyson

HTML

<div class="pull-right" id="actions" data-ph-title="I am a title" data-ph-type="and a type" data-ph-source="from a source" data-ph-subject="with a subject"></div>

<textarea id="placeholder-title" name="phTitle"></textarea>
<textarea id="placeholder-title" name="phType"></textarea>
<textarea id="placeholder-title" name="phSource"></textarea>
<textarea id="placeholder-title" name="phSubject"></textarea>

JavaScript

var info = $("#actions").data();

for (var key in info) {
  if (info.hasOwnProperty(key)) {
    $("[name='" + key + "']").val(info[key]);
  }
}