strong text
.my-p{
display: inline;
}
.my-div {}
.my-bold{
font-weight: 900;
}
<!DOCTYPE html>
<html>
<head> </head>
<body>
<div>
<p class="my-p">This is <div class="my-div"><span class="my-bold">First</span></div> line</p>
<p class="my-p">This is <div class="my-div"><span class="my-bold">Second</span></div> line</p>
<p class="my-p">This is <div class="my-div"><span class="my-bold">third</span></div> line</p>
<p class="my-p">This is <div class="my-div"><span class="my-bold">Fourth</span></div> line</p>
<p class="my-p">This is <div class="my-div"><span class="my-bold">Fifth</span></div> line</p>
<p class="my-p">This is <div class="my-div"><span class="my-bold">six</span></span></div> line</p>
<p class="my-p">This is <div class="my-div"><span class="my-bold">seven</span></div> line</p>
</div>
</body>
</html>
How can I select all <div>
elements by class-name "my-div"
, and change the elements' tag-name to span
.
I am trying to copy text form many pages from a website, it is has all these div in between p elements is making hard to copy in a readable manner when pasted it was pasting in multiple lines , where ever text is bold there is a div inside a div there is a span element and in that span element there is text and div has the same class name so I am looking for a method to select all div elements of same class name and change there tag name in to span
The desired output:
Present Output:
I was Tried to select the all div elements by using jQuery $$(.className) and it gives a list of all elements after that I Manual selected and changed the div to span and then it copied, same as how it appeared
but when I was using the CSS inline it did not worked property
sample website view
<body>
<p class="p-tag">
Lorem ipsum
<div class="div-tag">
<span class="span-tag">dolor</span>
</div>
sit amet consectetur adipisicing elit. Maxime
<div class="div-tag">
<span class="span-tag">mollitia</span>
</div>
,
</p>
<p class="p-tag" >
<b class="b-tag" >Lorem ipsum</b>
<div class="div-tag">
<span class="span-tag">sit amet consectetur adipisicing elit.</span>
</div>
</p>
</body>
` elements why are they there? Where are they coming from? Can you change your back-end service or script that's generating this (invalid) HTML? (The HTML is invalid because a block-level element - such as a `
` element.)