本文介绍了确定< div>的子代是否是& nbsp;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要检查div的内容是否为&nbsp;或更多的<div>等.

I need to check whether the contents of a div are either &nbsp; or more <div>'s and such.

我想也许我可以这样做,例如$('#right-rail').content或$('#right-rail').value甚至$('#right-rail').children(),但这似乎不起作用.

I thought maybe I could do this like $('#right-rail').content or $('#right-rail').value or even $('#right-rail').children(), but it doesn't seem to work.

我得到的只是未定义"或"[对象对象]".

All I get is either "undefined" or "[object Object]".

感谢我可以获得的帮助:).

Thanks for any help I can get :).

PS,如果您现在还没有猜到的话,请使用jQuery.

PS, using jQuery if you hadn't guessed by now.

推荐答案

$('#right-rail').html()返回#right-rail

这篇关于确定&lt; div&gt;的子代是否是&amp; nbsp;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 02:58