1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Form elements do not have associated labels

Discussion in 'HTML & Website Design' started by kertoon, Nov 27, 2023.

  1. #1
    I have this search box widget which has the above issue. This is the code:
    <form id="searchthis" action="/search" style="DISPLAY: inline" method="get"><input id="search-box" name="q" size="24" /> <input id="search-btn" value="Search" type="submit" /></form>
    HTML:

     
    Last edited by a moderator: Nov 27, 2023
    kertoon, Nov 27, 2023 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,479
    Likes Received:
    4,452
    Best Answers:
    123
    Trophy Points:
    665
    #2
    You have to actually add the labels by either of the following methods
    
    <form id="searchthis" action="/search" style="DISPLAY: inline" method="get">
    <label for='search-box'>Search</label><input id="search-box" name="q" size="24" /> 
    <input id="search-btn" value="Search" type="submit" /></form>
    HTML:
    
    <form id="searchthis" action="/search" style="DISPLAY: inline" method="get">
    <label>Search<input id="search-box" name="q" size="24" /></label> 
    <input id="search-btn" value="Search" type="submit" /></form>
    
    HTML:
     
    sarahk, Nov 27, 2023 IP
  3. kertoon

    kertoon Well-Known Member

    Messages:
    181
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    133
    #3
    I pasted the code just before the </body> tag and it works. Is it the correct place to set the code?
    Thank you so much for your prompt reply. :)It
     
    Last edited: Nov 27, 2023
    kertoon, Nov 27, 2023 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,479
    Likes Received:
    4,452
    Best Answers:
    123
    Trophy Points:
    665
    #4
    It definitely needs to be in the body section but it'll be in wherever on the page works.
     
    sarahk, Nov 28, 2023 IP
  5. kertoon

    kertoon Well-Known Member

    Messages:
    181
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    133
    #5
    Thank you again.
     
    kertoon, Dec 1, 2023 IP