I want to go through all fields of a form and determine if the fields are populated with data. When all fields are given, I'd like a button save to appear.
This is the Fiddle with code, that works (!) ...
This is the same in JavaScript.
The jQuery-Object to iterate through:
formElements = $ 'form input[type="text"], form input[type="number"], form textarea'
The Function:
formFilled = ->
filled = true
formElements.each ->
if $(this).val().length is 0
filled = false
filled
The Event-Handler:
formElements.on 'keyup', (keyup) ->
keyup.preventDefault()
if formFilled()
save.show()
else
save.hide()
Any suggestions?
savenever shows up (is hidden all the time) ...keyuphandler get called at all? DoesformElementsactually have anything in it?javascripttext in the bottom left text area