Although it's sloppy markup, the browser will parse it just fine as it is. Since paragraphs can't be nested, the browser will put an implicit closing tag before the second p and at the end of the body for the second p.
Up vote -2 down vote favorite share g+ share fb share tw.
I am trying to write a selector that selects everything within a p However, the HTML I am trying to select from does not close the p, instead it uses a /br like this: Some Text Here Some more text When I use a selector that is just p, it selects Some Text Here Some more Text, not the two individual elements. Is there any way to write a selector that will match both elements? Note: I am NOT in control of this HTML, but yet I need to parse it jquery selector link|improve this question edited Jan 11 at 9:37 asked Jan 11 at 2:43gregm1,89411128 74% accept rate.
It isn't possible to select just the opening p html because the p element consists of both the opening tag and the closing tag. YOu can however select the text you want using .contents() and filtering to the first text node. – Kevin B Jan 11 at 2:45 1 use proper html?
– nathan gonzalez Jan 11 at 2:45 jQuery doesn't support this as it is not valid code. I would recommend you use valid html then jQuery will work for what you need. – ATLChris Jan 11 at 2:56 @pst, actually researched it after typing that, but not quickly enough to avoid being chastised.
I stand corrected. – nathan gonzalez Jan 11 at 3:02 Kevin B: Is there a way to filter the contents in a selector to say "the contents until br>"? – gregm Jan 11 at 9:40.
Although it's sloppy markup, the browser will parse it just fine as it is. Since paragraphs can't be nested, the browser will put an implicit closing tag before the second p and at the end of the body for the second p. jsfiddle.net/KpJNH/1.
1. Op should update the html, but it will work as is. The difficulty was that you were selecting the text of both tags at the same time.
Take a look at the fiddle to see the difference. – nathan gonzalez Jan 11 at 2:53.
This should be a comment not an answer – jmein Jan 11 at 2:54.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.