开发者

JQuery: changes applied to DOM but not reflected in the browser

开发者 https://www.devze.com 2023-02-13 13:40 出处:网络
On my page, I run: someElementWrappedByJQuery.hide(); alert (someElementWrappedByJQuery.css(\'display\'));

On my page, I run:

someElementWrappedByJQuery.hide();
alert (someElementWrappedByJQuery.css('display'));

The result: I see the element shown on the page, like hide() didn't work. However, the alerted value is "none"

More info:

  • it's not only a hide() problem. Many different commands t开发者_运维知识库hat are run, don't have a real effect, but seem to be somehow applied to the DOM when I query about them programatically.
  • When I move someElementWrappedByJQuery to other place on the page (above some point, which I'm not sure exactly what it is), the problem disappears.
  • Problem seen in chrome and IE

Any ideas what can be going on here?

edit: solved, see my answer to myself below. and I see that someone has suggested this

Thanks

Gidi


Hmm...

Solved.

The element someElementWrappedByJQuery has already been on the page, added as a hidden elemnt by someone else

Now, I added another one. So all the commands were applied to the other one, and not to the one I added.

When I moved mine, above the point where the hiddent element was placed, obviously the problem disappeared.

0

精彩评论

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