In a view, I'm trying to retrieve the value of an html input box AFTER I have changed it. In other words, the page loads with
<input id="input_one" type="text" value = "apple" />
When the page opens the input box has the word apple in it. I click on this input box, erase the word apple, and then write the word "orange" in instead. when I do the following:
$('#input_one').click(function() {
console.log($('#input_one').attr('value'));
});
the result is "apple" not orange. Is there a way to get the new value I just input without submitting the form? I'm trying to make client side validation using javascript on the page, if the value is something, submit form, otherwise display message "value must be something"
maybe I can do something like
$('#input_one').attr('value', 'new value');
but how do I get the new value I just put in? where is this new value stored? innerHTML? or text() maybe?