jQuery, Select Body but exclude Textarea and Input:Text, how?

一个人想着一个人 提交于 2019-12-13 07:15:15

问题


I tried this $('body').children().not('textarea input:text') But not working. Anyone has an idea?

I want this because when I use jQuery.translator, I do not want the textarea and input:text get transalted, so I like to exclude them. If you know a better way to do this, let me know. Thanks.

EDIT

I think I asked a wrong question, please check here for new question Do NOT translate textarea by jQuery.translator, how?

I am going to close this one now. thanks


回答1:


$('body *:not(textarea, input:text)')

children() only gives you the immediate children, and it's unlikely you have input elements directly under body without some kind of structure intervening. Also, 'textarea input:text' means text inputs that are within a textarea, which will (hopefully) never happen.




回答2:


Try this:

$('*:not(textarea,:text)', document.body);


来源:https://stackoverflow.com/questions/8631078/jquery-select-body-but-exclude-textarea-and-inputtext-how

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!