Wednesday, July 1, 2009

[jQuery] Re: Event for when a <select> is changed?

Just simplify it like:

$("#theSelectsID").change(function () {
var str = $(this).val();
//or -- var str = this.value;
});

On Jun 30, 11:51 pm, "developm...@sdinternet.co.uk"
<p...@sdinternet.co.uk> wrote:
> If you have a single dropdown list with the id of 'theSelectsID' the
> below code should store the selected item into the variable 'str'.
> Hope that helps
>
>     $("#theSelectsID").change(function () {
>           var str = "";
>           str = $("#theSelectsID").val();
>         });

No comments: