I have an <i>
tag with:
<a class="welcome-page-left hidden-xs" href="#page-slider" data-slide="prev"><i class="fa fa-chevron-left"></i></a>
<a class="welcome-page-right hidden-xs" href="#page-slider" data-slide="next"><i class="fa fa-chevron-right"></i></a>
This are just to "arrows" in each side of the screen. The layout of my page is "all in one" meaning that there is no reload for a new page, "Home"- "About" -"etc" pages are all in the same MAIN page and you just move around them with the arrows in the right and left side of the screen.
I have a file input tag in the homepage and i would like to disable this arrows Until the user submit's the file. This is my input tag:
<form action="{% url "do_some_work" %}" method="POST" enctype="multipart/form-data" class="custom-form-thing">
{% csrf_token %}
<div class="inputWrapper">
<input id="some_file_input" type="file" name="some_file" class="custom-input-thing" data-buttonName="btn-primary" data-icon="true">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
I know nothing about javascript but with hel i managed to disable the submit button until the user chooses his/her file. I guess there is no much difference in this case with the arrows but i suck at javascript as i said.
Thanks in advance for any help.
Question: How could i disable this arrows until the user submits the file?
EDIT
This is how i disabled the submit button in the form, is to different to disable the tags?:
<script>
$('form').submit(function(event){
validated = true;
if ($('#some_file_input').get(0).files.length === 0) {
validated = false;
console.log("No files selected.");
// Or some div with image showing
var div = document.createElement('div');
div.innerHTML = "<img src='{% static "wappApp/images/Icono_de_Alto.png"%}' classs= 'imgclass'>";
// better to use CSS though - just set class
div.setAttribute('class', 'myclass'); // and make sure myclass has some styles in css
document.body.appendChild(div);
$('.myclass').finish().fadeIn("fast").delay(2000).fadeOut("slow");
}
if (validated != true) {
event.preventDefault();
}
});
</script>