2
In the form of my website, I have a field textarea and a button Submit. Follow the code of both:
<textarea name='texto1' id="txtBriefing" rows="5" style="font-family: Trebuchet MS; font-size: 16px; width: 394px; height: 100px" onkeyup="doSomething(this.value)" ></textarea>
<input name="btnEnvia" type="submit" value="Enviar" style="font-family: Trebuchet MS; font-size: 20px" />
However, I would like that button to be enabled only if the textarea txtBriefing
not empty. I’ve tried some javascript codes with the functions onkeyup
and onchange
looking on the internet, but none worked so far.
What can be done for this case?
In the first example, the button is clickable even with the empty txtarea.
– user28595
Adds a
disabled="disabled"
straight into html, updated the example– Jeferson Assis
I edited the function to make it cleaner
– Jeferson Assis
I saw, +1 for having different and functional options.
– user28595
Thanks :), someone gave -1 do not know why kkkkk
– Jeferson Assis