I am trying to get a separate div (a custom 'continue' button) to appear when the user starts typing into a text input.
I am currently using this:
var submitButton = $('#submitButton');
submitButton.hide();
submitButton.on("showSubmitButton", function(event) {
$( this ).show();
$( this ).css('opacity', '0');
$( this ).fadeTo(400, 0.6);
});
var textInput = $('#textInput');
textInput.click(function() {
$( this ).find('input:text').val(''); // this clears the default 'type your name here' text
});
textInput.keyDown(function() {
submitButton.trigger("showSubmitButton");
});
When I had the "showSubmitButton" line inside the textInput.click function the submit button appeared on the click, but I want the button only to appear when the user has typed something into the input.
I have also used .keyPress(), but both key events trigger a 'has no method' error. I assume I must be using them incorrectly, but I don't know how.