/    Sign up×
Community /Pin to ProfileBookmark

I have a JavaScript function that is triggered by the onBlur event of an <input type=”text”> field. My problem occurs when this field has the input focus and another button on the same form is clicked.

The onBlur event for the text field executes, but the onClick event for the button is somehow lost.

I’m told this is because my onBlur function is throwing up a “Confirm” box, which is somehow causing the onClick event to be forgotten.

Is there a way around this?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@steelersfan88Apr 06.2004 — I see what you mean by the following:&lt;input onblur="confirm('Hi?')"&gt;
&lt;input onclick="alert('hi!')"&gt;
well, i'm not sure how to do this, but i know you could run the confirm in the onclick of the second element by checking the focus of the previous element.
×

Success!

Help @TomFrantz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...