Reputation: 868
I have a standard input type text field that is supposed to trigger a Javascript whenever it is changed. First I tried onChange, however it just did nothing. Then I tried onBlur, but also here it did not do anything.
HTML Code:
<input type="text" size="1" class="inputbox" onblur="c();" name="qty" value="1" />
The Javascript should not be the problem, because I am triggering this with another select dropdown menu as well and there it works fine! Just on this text field it seems not to work. Anyways, here's the Javascript code:
function c() {
$('#add4').fadeOut(function(){
$('#add5').css('visibility', 'visible');
document.u.submit();
});
}
I checked online, but could not find any relevant posts or hints in this regard whatsoever. Any ideas what's wrong?
Upvotes: 2
Views: 10650
Reputation: 2151
This may solve your problem:
<input type="text" size="1" class="inputbox" onblur=" javascript:c(); " name="qty" value="1" />
Upvotes: -1
Reputation: 2443
try this
<form>
<input id="target" type="text" value="Field 1">
<input type="text" value="Field 2">
</form>
<div id="other">
Trigger the handler
</div>
The event handler can be bound to the first input field:
$( "#target" ).blur(function() {
alert( "Handler for .blur() called." );
});
check this links for your reference http://api.jquery.com/blur/
http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_event_blur_alert
Hope this help
Upvotes: 3