JSFiddle - React, Tailwind, and code Playground
by slawe
HTML
<div id="yt_upload_file_container">
<input type="text" id="yt_up_title" name="title" placeholder="Title...">
<textarea id="yt_up_description" name="description" rows="3"
placeholder="Video description..."></textarea>
<textarea id="yt_up_tag" name="tag" rows="1"
placeholder="Tags (e.g., flying pig, mashup)"></textarea>
<div id="yt_selector">
<select id="yt_up_category" name="category">
<option value="0" >Autos & Vehicles</option>
<option value="1">Comedy</option>
<option value="2">Education</option>
<option value="3">Entertainment</option>
<option value="4">Film & Animation</option>
<option value="5">Gaming</option>
<option value="6">Howto & Style</option>
<option value="7">Music</option>
<option value="8">News & Politics</option>
<option value="9">Nonprofits & Activism</option>
<option value="11" selected>People & Blogs</option>
<option value="7">Pets & Animals</option>
<option value="8">Science & Technology</option>
<option value="9">Sports</option>
<option value="10">Travel & Events</option>
</select>
</div>
<div id="yt_choose_file">
<div id="__yt">Choose Video</div>
<input type="file" name="file_to_upload" id="file_to_upload">
<input type="hidden" value="" id="yt_up_file" name="yt_up_file">
</div>
<input type="submit" name="upload_video" id="upload_video" value="Upload">
JavaScript
function formValidation(oEvent) {
oEvent = oEvent || window.event;
var txtField = oEvent.target || oEvent.srcElement;
var t1ck=true;
var msg=" ";
if(document.getElementById("yt_up_title").value.length < 1 )
{ t1ck=false; }
if (document.getElementById('yt_up_description').value.length < 1 )
{ t1ck=false; }
if (document.getElementById('yt_up_tag').value.length < 1 )
{ t1ck=false; }
if(t1ck){document.getElementById("upload_video").disabled = false; }
else{document.getElementById("upload_video").disabled = true; }
}
window.onload = function () {
var btnSignUp = document.getElementById("upload_video");
var t1 = document.getElementById("yt_up_title");
var t2 = document.getElementById('yt_up_description');
var t3 = document.getElementById('yt_up_tag');
var t4 = document.getElementById('file_to_upload');
var t1ck=false;
document.getElementById("upload_video").disabled = true;
t1.onkeyup = formValidation;
t2.onkeyup = formValidation;
t3.onkeyup = formValidation;
t4.onkeyup = formValidation;
};