Note. I misunderstood the question, because of something I came here from the "HTML" -tag. But if you want to do something similar using HTML / CSS, this might be one solution.
You can do something like this:
<style> label.mylabel, input.myinput { display: block; float: left; height: 20px; margin: 0; padding: 10px 5px 0px 5px; border: 1px solid #ccc; font-size: 11px; line-height: 11px; } label.mylabel { border-right: 0; } input.myinput { border-left: 0; } </style> <label class="mylabel" for="myinput">http://</label> <input id="myinput" class="myinput" name="myinput" value="">
Thus, it has two advantages:
- it looks like a single input field
- when the user clicks "http", the actual form field will be focused
And, of course, you must add "http: //" manually after submitting the form.
All this has one drawback. What if your user wants to insert 'https: //'? :)
Cheers philipp
insertusernamehere Jun 14 2018-12-14T00: 00Z
source share