I have a content editable div where users can enter their bio and then save the information. I use a form submit and the data I submit is $('#bio').html() where the bio tag has the attribute content editable. All of this works very well unless the user hits enter and then it creates a div tag and/or a <br>, which are saved as the user’s bio and then displayed with the html elements intact, which looks sloppy.
I am looking for either for some way of saving only the text or a way of display only the text. Ideally, I would like to be able to keep the new line without displaying the <div> or <br>.
If this is at all useful, I am using Ruby-on-Rails 3.
Thanks, Welles
use
strip_tagsmethod in your controllerOr if you want the
to be converted to “\n”(new line), then do this