Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2004
    Location
    undefine
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to prevent <div> from separating another line

    I use:
    <html>
    <body>
    *Guaranteed Cash Value:$<div onClick="javascript:this.innerHTML='1111'">4,029</div>at age of 65.
    </body>
    </html>
    I only want to change money when click though I know by changing the innerHTML use whole sentence.
    undefine

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,047
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Use <span> instead of <div>.
    <div>s (just like <table>, <p>) are block elements so, they are supposed to display in another line. Although you can change the display property to inline, it is still recommended to use tags properly. <p> for paragraphs, <div> for divisions, ....


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •