众所周知,这样做很好
$("#foo").html = "bar";
Run Code Online (Sandbox Code Playgroud)
但是我该怎么做呢?
var i = "foo";
$(i).html= "bar";
Run Code Online (Sandbox Code Playgroud)
我也试过$("#"+i)了,但那也行不通.
这不起作用.
$("#foo").html = "bar"; //Overwrites the object's html function with a string
Run Code Online (Sandbox Code Playgroud)
这应该.
$("#"+i).html("bar"); //Sets the inner HTML of the selected element.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
73 次 |
| 最近记录: |