JSFiddle - React, Tailwind, and code Playground

by I Sang Hyeon

HTML

<p>
<label for="inpTarget">Target : </label>
<input type="text" id="inpTarget" data-type="inputType" data-temp-value="ThisIsTempValue" value="Data-Attribute"/>
<button id="btn">Get</button>
</p>
<p>
<label for="inpResult1">data-type : </label>
<input type="text" id="inpResult1" value=""/>
</p>
<p>
<label for="inpResult2">data-temp-value : </label>
<input type="text" id="inpResult2" value="" />
</p>

JavaScript

$('#btn').click(function(){
	//alert('t: '+document.getElementById('inpTarget').dataset.type);
	$('#inpResult1').val(document.getElementById('inpTarget').dataset.type);
  //$('#inpResult1').val($('#inpTarget').dataset.dataType);
  //$('#inpResult2').val($('#inpTarget').dataset.dataTempValue);
});