Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a input textbox without using <input type="text">

I want to create a input textbox that does not require a <input type="text"> form element. The user can still type text into this textbox and the value can still be retrieved using Javascript/jQuery. The reason for doing this is because this textbox will be in a form that upon submit, all form input values will be sent to the server side for processing, and there is this textbox that I dont want its values to be automatically send to server side.

Problem: What is the best way to create such a textbox without relying on HTML form elements input?

like image 756
Nyxynyx Avatar asked Nov 13 '11 13:11

Nyxynyx


People also ask

How do I make an input box non-editable?

The readonly attribute makes a form control non-editable (or “read only”). A read-only field can't be modified, but, unlike disabled , you can tab into it, highlight it, and copy its contents. Setting the value to null does not remove the effects of the attribute. Instead use removeAttribute('readonly') .

Can input be used without form?

Yes, you can have a valid input without a form.


1 Answers

Just don't give the <input type="text"> tag a name attribute and it won't submit. Here is an example:

<input type="text" id="myinput" value="you will not see this submitted" />
like image 189
Asaph Avatar answered Oct 05 '22 22:10

Asaph