I've been trying to change the border-color of a textarea when the focus gets out, but it's not doing anything, not even if I'm only trying to alert something.
These are the methods I've tried so far:
The first:
$('#idname').on('blur', function() {
alert(1);
});
The second:
document.getElementById('idname').onblur() = function () {
alert(1);
}
The third:
function redBlur() {
alert(1);
}
And the html:
<textarea rows="1" cols="10" type="email" id="idname" name="title" onblur="redBlur()"></textarea>
$('#idname').on('blur', function() {
alert(1);
});
document.getElementById('idname').onblur() = function () {
alert(1);
}
function redBlur() {
alert(1);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<textarea rows="1" cols="10" type="email" id="idname" name="title" onblur="redBlur()"></textarea>
Do you have any idea as to what I'm doing wrong?
Thanks.