So I am currently looking for a solution to insert align="center" into a block quote. I am hitting an API and getting back a string of HTML as shown:
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Las Vegas utilities really don’t want the strip to go solar blah blah</blockquote>
What I am trying to do is add an align="center" to the blockquote in the most efficient way as shown below:
<blockquote class="twitter-tweet" align="center"><p lang="en" dir="ltr"></blockquote>
I am currently going Rambo and just replacing the string using:
myString = myString.replace("<blockquote class=\"twitter-tweet\">", "<blockquote class=\"twitter-tweet\" align=\"center\">");
But it feels as if this is a hacky solution as I am fairly new to JavaScript. Is there a better way to do it using JQuery and serializing the HTML that I am missing?
Thank you all in advance!
blockquoteReference.style.textAlign = 'center'?align="center"has been deprecated for quite some time now. Use CSS.