WordPress.org

Ready to get started?Download WordPress

Forums

Radio button input elements add a <br /> element (6 posts)

  1. albeeboy
    Member
    Posted 3 years ago #

    I have a form with three radio buttons. I want the layout of the three radio buttons to be all on one line. I have carefully written my form markup to include no returns or soft-returns in the content window (sometimes content windows add returns if they are visible in the composing window). However, when I publish the page, each radio button shows up on its own line. When I look at the page source, there are indeed <br/ > tags inserted just before each <input type="radio" /> tag. These do not exist in my original markup. Does anyone know why these are being added? I am using a custom theme, but if I activate the TwentyTen theme, the same problem persists, So I'm guessing it has nothing to do with any of the custom theme code.

  2. Curtiss Grymala
    Member
    Posted 3 years ago #

    Are you adding the form code directly to your theme, or are you adding the code to a page or post in WordPress?

  3. albeeboy
    Member
    Posted 3 years ago #

    I'm adding the markup directly to a page.

  4. Curtiss Grymala
    Member
    Posted 3 years ago #

    If you're adding the markup in the post/page editor, then you need to understand that in HTML view, any new line will be converted automatically to a <br/> tag and two new lines together will be converted automatically to a <p>.

    Therefore, if you are adding the markup to the post/page editor, you will need to use markup like:
    <input type="radio"/><input type="radio"/>
    instead of:

    <input type="radio"/>
    <input type="radio"/>
  5. albeeboy
    Member
    Posted 3 years ago #

    Thanks for this answer. The point that I am making is that I have been very careful to enter my mark-up exactly as you described, with no new lines in the page editor. Literally, I have entered it as one long line of characters, and my form still inserts the <br /> elements. It seems to only add them before each <input type="radio" /> element because I also have a series of three <input type="text" /> elements that do output on one line as intended. I'm wondering if there is some sort of default function that makes radio buttons and checkboxes output on separate lines instead of on one line.

  6. susan303
    Member
    Posted 3 years ago #

    I was having the same problem. Here's a post that solved it for me:

    http://wordpress.org/support/topic/auto-formatting-glitch-in-21

Topic Closed

This topic has been closed to new replies.

About this Topic