JSFiddle - React, Tailwind, and code Playground
HTML
<div data-role="page" id="home">
<div data-role="popup" id="errorDialog" class='ui-corner-none ui-content'>
<p id="errormsg"></p>
</div>
<div data-role="popup" id="addFolderDialog" class='ui-corner-none portalpopup'>
<div data-role='content'>
<p></p>
<div data-role="fieldcontain">
<label for="name">New Folder:</label>
<input type="text" name="name" id="newfolder_val" value="" class="ret_submit" rel="adddir_submit" />
</div>
<div class="clearfix">
<a data-role="button" data-inline="true" data-theme="b" id="adddir_submit" onclick='create_folder_submit()'>Add Folder</a>
<a data-role="button" data-inline="true" data-rel='back'>Cancel</a>
</div>
</div>
</div>
<p><a href="#addFolderDialog" data-rel="popup">Open Popup</a></p>
</div>
JavaScript
window.create_folder_submit = function () {
$("#addFolderDialog").popup("close");
$("#errormsg").text("ERROR!");
$("#errorDialog").popup("open");
}