开发者

jquery: how to select element from innerHTML?

I have to autocomplete for a textbox within an innerHTML(this innerHTML is loaded by AJAX) , normally if we use $("#elementid").autopopulate will work if elementid is within in an html content, but it will not work for if elementid is within an innerHTML in the same page. When i checked with Firebug, the AJAX call is not fired when we enter a character? The problem is with the selection, i guess, so I need to know how to select an element within an innerHTML?

thanks in advance.


I need one more help..after the user selecting the autocompleted value from the list in textbox, i need to do some operation on the same and get printed the resulted value on anot开发者_Go百科her textbox, how will i achieve this?


see jquery code below for calling elt in innerhtml

$(function(){ $("input[name='item_no']").autocomplete("auto/finditem.cfm"); })


EDIT:

In those cases there is Fiddle:

http://jsfiddle.net/rgkQK/

I made up an example of your code. I hope this will help.

If I get you right you want to select a child element from a parent element.

You have to use the following jQuery selector

jQuery('parent > child')

Documentation at: http://api.jquery.com/child-selector/


Try calling $("#textid").autocomplete("auto/finditem.cfm"); in the ajax request's success-function

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜