Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8753761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:29:14+00:00 2026-06-13T13:29:14+00:00

I have a content editable div where users can enter their bio and then

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:29:15+00:00Added an answer on June 13, 2026 at 1:29 pm

    use strip_tags method in your controller

    > ActionController::Base.helpers.strip_tags("<br><div>sample")
    > # => "sample"
    

    Or if you want the
    to be converted to “\n”(new line), then do this

    > "<br>sample".gsub(/<br>/, "\n") 
    > "\nsample"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a contenteditable div where users can enter up to about 20kb of
I have a content editable div. Within this I am inserting a <pre>some code</pre>
I have a <div> that is set to be content editable and has a
I have the following CSS code .editable:before { content: url(../images/icons/icon1.png); padding-right:5px; } this is
I have a helper called EditableArea which provides a user with a runtime-editable div
So I am trying to create an RTE environment. I have a content editable
I have a contenteditable div that I want users to be able to select
Let's say I have a contentEditable div , to the user can edit and
I have a contenteditable div with an id of editable in which I've simulated
How to remove all div tags, but not content, which it have? (Working with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.