开发者

Targeting elements in a jQuery Dialog, Why must use this as context

开发者 https://www.devze.com 2023-02-03 09:15 出处:网络
I find that when I am trying to target an element in a jQuery Dialog, I must do something like $(\"#elemInDialog\", this).val()

I find that when I am trying to target an element in a jQuery Dialog, I must do something like

$("#elemInDialog", this).val()
                   ^

I found that this only occurs in my simple code seen http://jiewmeng.kodingen.com/test/jquery-autocomplete.html or http://jsfiddle.net/28GMT/ (in jsFiddle or jsbin, the auto complete doesn't wor开发者_C百科k even, but it works in my hosted version) what did I do wrong?


You have at least one typo in there:

This line:

$("#txtArea").val( $("#txtArea").val() + "\n" + $("#txtUrl").val() );

should be:

$("#txtArea").val( $("#txtArea").val() + "\n" + $("#txtURL").val() );

With that fix, things seem to work okay for me, as far as I can tell?

0

精彩评论

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