JSFiddle - React, Tailwind, and code Playground
HTML
<span class="twitter-typeahead" style="position: relative; display: inline-block;">
<input class="typeahead form-control tt-hint" value="" type="text" id="week_autocomplete" autocomplete="off" spellcheck="false" tabindex="-1" dir="ltr">
<input class="typeahead form-control tt-input" name="year_autocomplete" value="" type="text" id="year_autocomplete" autocomplete="off" spellcheck="false" dir="auto">
<input name="week" value="0" type="hidden" id="week">
<input name="year" value="1" type="hidden" id="year">
</span>
JavaScript
$(function(){
var hiddenId;
$("input.typeahead").click(function(){
var idInputField = $(this).attr("id");//***_complete
hiddenId = idInputField.split("_").slice(0,1);//****
if(!parseInt($("#"+hiddenId[0]).val())){
console.log('Беда');
} else {
console.log('Норм');
}
});
});