Skip to main content
WolfShade
Legend
June 6, 2018
Question

Double alert from one alert()

  • June 6, 2018
  • 1 reply
  • 317 views

Hello, all,

I've got a weird glitch that I can't quite track down.  Here is some pseudo-code:

<select id="status_A"><option value="0">Unverified</option><option value="1">Verified</option><option value="2">Unsubscribed</option></select>

<select id="status_B"><option value="0">Unverified</option><option value="1">Verified</option><option value="2">Unsubscribed</option></select>

<select id="status_C"><option value="0">Unverified</option><option value="1">Verified</option><option value="2">Unsubscribed</option></select>

...

<script src="/path/to/jquery/jquery.min.js"></script>

<script>

     $('[id^="status_"]').on('change',function(){

          var $thisVal = $(this).val();

          alert($thisVal);

          });

</script>

When a select is changed, for example the first select is changed from the default Unverified to Verified, I will get an alert that displays "1", and then when I close that alert another alert (with no value displayed) pops up.  Any ideas what might be causing this?

V/r,

^ _ ^

    This topic has been closed for replies.

    1 reply

    Legend
    June 6, 2018

    Works ok here in FF & Chrome. Wrap the jQuery in a document ready function, see if that makes any difference

    $(document).ready(function(){

    });

    WolfShade
    WolfShadeAuthor
    Legend
    June 6, 2018

    I always place my jQuery at the bottom of the document so I won't be required to use document.ready.  Always placed just before the closing </body> tag.

    V/r,

    ^ _ ^

    Legend
    June 6, 2018

    WolfShade  wrote

    I always place my jQuery at the bottom of the document so I won't be required to use document.ready.  Always placed just before the closing </body> tag.

    V/r,

    ^ _ ^

    What browser are you testing in?