is it possible that u r attaching this event handler multiple times to the
link, probably by calling ur addClass() method somewhere...

also, can u post a test page somewhere where we can have a look at what is
going on.

-GTG


On 6/28/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


I have a page (edit.asp) which uses the .load() to load another page
into a div. Inside this loaded page (students.asp) is a select box
(id="classavailable") and a link (id="ajaxAdd").

I am trying to run an event after the user selects a value in the
select box and clicks the link. Right now, I just have it set up to
run an alert:

This is the jQuery on edit.asp, the main page:

function addClass() {
$("#ajaxAdd").click(function(){
               alert($('#classavailable').val());
});
}

After a user selects a value and clicks the link for the first time,
nothing happens. If the link is clicked again (with no other
interaction) the function runs. If a user then changes the select
value and clicks the link, the function runs twice. If a user selects
a third unique value and clicks the link, the function runs three
times.

What I want is the function to run only once and when the link is
clicked. Can anyone tell me what I have overlooked?

Thanks!

- Seth


Reply via email to