简体   繁体   中英

Place text and a hyperlink inside an <input>

I'm trying to do something i think should be simple but i'm not getting it right, these are the lines i have written with no luck:

<input type="checkbox"> I agree to the <a hraf="terms & conditions.html></a> </input>
                        [i want this       [this is the page i want the
                         as regular             hyperlink to go to]
                            text]

how can i make it right? Thanks!

You need to use label like:

 <label for='checkterm'>I agree to the <a href="terms & conditions.html">terms</a></label> <input type="checkbox" id='checkterm'>

Reference:


I recommend that you also readthis article regarding inputs (I see that you make mistakes)

Try with this:

 <input style="float:none; vertical-align: middle;" type="checkbox" id="agree" />
  <label style="display:inline; float:none" for="agree">
    I agree with the <a href="/pages/terms-and-conditions">terms and conditions</a>.
  </label>

Also check that you put the tag correctly. <a href=...> , you've got a mistake (you did put hraf).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM