开发者

onfocus stop work after reload content in parent object

开发者 https://www.devze.com 2023-01-07 11:14 出处:网络
I load content to theusing AJAX. in content you can find this line of code: <input onfocus=\'searchItems(\"sContainer\", this)\' onblur=\'searchItemsStop()\'/>

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.

onfocus stop work after reload content in parent object

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?


The problem was in different place that i watched.

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

Problem solved.

0

精彩评论

暂无评论...
验证码 换一张
取 消