GOOT
GOOT

Reputation: 169

Using jQuery how do you prompt a message with a select menu option?

I need to prompt an alert message when a user selects a particular option in a select menu. Is there a way to do this using jQuery?

Upvotes: 2

Views: 1271

Answers (2)

Neil Aitken
Neil Aitken

Reputation: 7854

assuming your select has an ID of myselect, and the value you want to check is "myval"

$("#myselect").change(function() {
   if($(this).val() == "myval")
    {
       alert('message');
    }
});

I havent tested this but the concept should be sound

Upvotes: 3

ayaz
ayaz

Reputation: 10502

I recently bumped into the jQuery Confirm Plugin. It may or may be what you are looking for.

Upvotes: 0

Related Questions