I guess i am doing something wrong. If i try this

$('#mainWindow').click(function() { alert("Hello"); });
$("#mainWindow").unbind( "click", function() { alert("Hello"); });

where the functions are identical, it still does not work. It will invoke
the alert function when i click in the mainWindow. 

I must be missing something. 

Cheers

Phil



Sam Collett wrote:
> 
> On 14/12/06, floepi <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>> i have the following problem using the events in jQuery:
>>
>> $('#mainWindow').click(function(){
>>  alert('test');
>> });
>>
>> and load this function at the end of a php script:
>> <?php
>> bla bla bla
>> ?>
>> <script>
>> my function
>> </script>
>>
>> The problem is that i load this data into the mainWindow which means,
>> that
>> the event gets attached each time i load content into the mainWindow. So
>> when i click in the mainWindow i get multiple alert messages.
>>
>> Is there a way to tell jQuery to overwrite the event if the function is
>> the
>> same. Otherwise i have to use the specific unbind each time i load data
>> into
>> the window, which feels hacky and unnecessary.
>>
>> Thanks for your time. Maybe you know how to solve my problem.
>>
>> Cheers
>>
>> Phil
> 
> Have you tried 'unclick'?
> 
> $('#mainWindow').unclick().click(...
> 
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Duplicate-Events-tf2820382.html#a7873232
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to