Title: javaScript need help Post by: omer-jamal on July 03, 2019, 02:51:29 AM hi there, :)
I'm try to get quote content without internal quotations here is include all internal quotations inside the tag this is what I don't want Code: var quote = document.querySelectorAll(".quoteheader+.quote"); how can do like that ? only quote content without internal quotations https://i.ibb.co/2yDTQL7/image.png Title: Re: javaScript need help Post by: omer-jamal on July 07, 2019, 10:09:47 AM mention @suchmoon are there any ideas? to access quote content without internal quotations?
Title: Re: javaScript need help Post by: suchmoon on July 07, 2019, 01:34:51 PM mention @suchmoon are there any ideas? to access quote content without internal quotations? If you want a list of only first-level quotes do this: Code: let list_of_first_level_quotes = document.querySelectorAll(".post > .quote"); If you want to remove/ignore the content of inner quotes - you can't do that with a single querySelector, but depending on how you want to process it you can do something like this: Code: document.querySelectorAll(".post > .quote").forEach(e => { let without_inner_quotes = e.querySelectorAll(":not(.quote):not(.quoteheader)"); /* do something here */ }); Title: Re: javaScript need help Post by: omer-jamal on July 07, 2019, 08:58:34 PM Code: document.querySelectorAll(".post > .quote").forEach(e => { let without_inner_quotes = e.querySelectorAll(":not(.quote):not(.quoteheader)"); /* do something here */ }); console.log( without_inner_quotes ); https://i.ibb.co/9w5XnSM/kjk.png what i want do check every {quote without_inner_quotes} and check innerText.lenght and when lenght for example > 100 hide quote text something like so if any way to get {quote without_inner_quotes} Children nodes include text node Code: quote2.forEach( function(e){ Title: Re: javaScript need help Post by: suchmoon on July 07, 2019, 09:37:48 PM what i want do check every {quote without_inner_quotes} and check innerText.lenght and when lenght for example > 100 hide quote text Ok, then I guess you could just subtract the length of inner quotes from the total text length, like this Code: document.querySelectorAll(".post > .quote").forEach(e => { |