While entering space in staring am getting following code from summernote textarea,
<p><br></p><p><br></p><p><strong style="font-family: "Open Sans", Arial, sans-serif; text-align: justify;">Lorem Ipsum</strong><span style="font-family: "Open Sans", Arial, sans-serif; text-align: justify;"> is simply dummy text of the printing and typesetting industry. </span><br></p><p><br></p><p><br></p>
but i want to remove the starting <p><br></p><p><br></p>
before storing to db.
for example i want to store like below,
<p><strong style="font-family: "Open Sans", Arial, sans-serif; text-align: justify;">Lorem Ipsum</strong><span style="font-family: "Open Sans", Arial, sans-serif; text-align: justify;"> is simply dummy text of the printing and typesetting industry. </span><br></p>
If you are sure about the pattren than You can achieve it something like
var data='<p><br></p><p><br></p><p><strong style="font-family: "Open Sans", Arial, sans-serif; text-align: justify;">Lorem Ipsum</strong><span style="font-family: "Open Sans", Arial, sans-serif; text-align: justify;"> is simply dummy text of the printing and typesetting industry. </span><br></p><p><br></p><p><br></p>';
while(data.startsWith('<p><br></p>')){
data=data.replace('<p><br></p>','')
}
while(data.endsWith('<p><br></p>')){
data=data.replace(new RegExp('<p><br></p>$'),'')
}
console.log(data)