how to make a textbox non clickable using html
Solution 1
Using readonly
attribute on element means that the element is not editable, however the value of field gets submitted when the form is submitted.
While disabled
element is not editable as readonly
but its value doesn't get submitted on form submission.
so, if you want to submit the value of the field, use:
<input type="text" name="textbox1" readonly />
else
<input type="text" name="textbox1" disabled="disabled" />
Solution 2
Try disabled="disabled"
. This will disable textbox / textarea, so it won't be selected. Also, the value won't be submitted on form submission.
For textbox :
<input type="text" name="textbox1" disabled="disabled" />
For textarea :
<textarea name="textarea1" disabled="disabled" /></textarea>
In HTML5, only disabled
attribute will also work. The value is not compulsory. However, for XHTML Strict you will need key & value
pair.
Solution 3
Try this i hope it works,
<input type="text" name="country" value="anytext" readonly>
Solution 4
<textarea disabled="disabled"></textarea>
user1859538
Updated on July 09, 2022Comments
-
user1859538 almost 2 years
I want to make textarea non-editable and non-clickable using html. I have given the "readonly=true" for the tags; however, it is still clickable but non-editable. The readonly textarea are getting selected in Safari browser. Please help. I do not want the text area and text box to get selected. Thanks
-
Pradip Kharbuja about 11 yearsi think it should be textarea not textbox. also for textbox you will need input tag.
-
user1859538 about 11 yearsI am really sorry. Yes the problem is with the textarea.
-
user1859538 about 11 years<td><html:textarea property="eyfXSmsPleTaPleTx" rows="5" cols="50" style="width:100%;" styleClass="formbox" readonly="true" disabled="disabled" ></html:textarea> This is the code I am using.
-
Matthew Dolman almost 6 yearsdouble clicking still allows for the selection of text