问题
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