Jump to content

Is this a bug in Chrome or am I missing something?


garyed

Recommended Posts

When using javascript onchange with an alert function chrome freezes up. I've tried the same code in Firefox & it works fine so I'm wondering if it is a bug or I need to do something different in Chrome. This code couldn't be any simpler & it locks up my browser & freezes my mouse. I'm running Chrome in Ubuntu Linux 18.04. The same happens if I try a confirm function with onchange but both confirm & alert work as long as they are not used with the onchange function.

<html>
<head>
</head>
<body>

<select name="testify" onchange="alert('something');">
<option value=1> one </option>
<option value=2> two </option> 
</select>

</body>
</html>

   

Link to comment
Share on other sites

If anyone is using Chromium broswer I'd be curious if they tried that code & see what happened.  That code that I posted is the whole html file & nothing else. I made that simple html file just to test the onchange & alert functions together to see why they wouldn't work on my website. In Firefox it works as expected but in Chrome it crashes my browser & freezes my mouse & I have go to the terminal to close the program down. I should have been more specific because it doesn't crash until you actually change from one option to the other. Then the alert pops up on the screen & that's when everything locks up. After spending most of the day on it I finally found a solution. There have evidently been some conflicts with Chrome & the alert & confirm javascript functions & the only thing that worked for me was to use the setTimeout function. After adding that, everything works in Chrome. It's possible it's just the particular Linux version of Chrome that I am using.

This works now:

<html>
<head>
</head>
<body>
<select name="testify" onchange="setTimeout(function(){ alert('something'); })">
<option value=1> one </option>
<option value=2> two </option> 
</select>

</body>
</html>

          

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.