Currently, I am in the process of incorporating an 'edit' button into a Django website using JavaScript. As someone who is newer to JavaScript, this task presents itself as quite challenging.
Thankfully, in Django, splitting text into paragraphs can easily be done by using {{ text|linebreaks }}
, as Django dynamically adds <p>
tags. To ensure a seamless transition (post-fetch request and response) with JavaScript, I need to develop a function that iterates through the edited text and generates <p>
tags accordingly.
However, I find myself stuck at the initial starting point. How exactly does one identify where each paragraph ends using JavaScript?