JSFiddle - React, Tailwind, and code Playground
HTML
<div class="zpoisk">
<input type="text" class="element-itemname">
<input id="ok" type="button" name="send-clone" value="ОК" class="ok">
</div>
<input class="element-tmpl-hidden" value="">
<input class="element-tmpl-hidden" value="">
<input class="element-tmpl-hidden" value="">
<input class="element-tmpl-hidden" value="">
JavaScript
(function($){ $(document).ready(function (zp) {
$("input#ok").bind('click', function() {
$inputVal = ($('input#ok').val().trim);
if ($($inputVal).val().length == 0){
alert ("Введите сначала поисковый запрос");
}
else {
// var $inputVal = $("input#ok").val();
$("input.element-tmpl-hidden").val($inputVal);
alert("Не пустой");
}
} );
});
})(jQuery);