views:

20

answers:

1

I load content to the using AJAX. in content you can find this line of code:

<input onfocus='searchItems("sContainer", this)' onblur='searchItemsStop()'/>

first time when I load the content onfocus and onblur events works. But when I reload the content onfocus and onblur stop working.

in firebug I noticed that for every reload of content onfocus and onblur events start to duplicating.

alt text

how can i solve this?

EDIT:

the loaded content is a table with list of products. I load this into popup div on user button click.

the searchItems check the input for user query, and show in the list only products which match to the query.

When user close popup, all content is removed by .removeChild, so why the events are not deleted with the content too?

A: 

The problem was in different place that i watched.

searchItems function was using referance only to the first (deleted later) input element.

Problem solved.

Dobiatowski