Reputation: 412
i have a text field in a form
<form action="">
<input type="text" id="input_id"></input>
<button type="button" id="button_id"></input>
.
.
.
</form>
each time i entered some values in the input field, there seems to be a recored where it is stored, and then when i entered some other values, those already entered come up as suggestion type, but i don't want that to happen. How can i disable this for that particular field. forgive me if i sound ignorant but i'm blind here... any suggestion and help will be highly appreciated. i don't have a clue how to start.
Upvotes: 0
Views: 2400
Reputation: 11381
You could maybe add autocomplete="off"
attribute to the textbox.
<input type="text" id="input_id" autocomplete="off" />
And if this doesn't work, you could generate some random data-*
attributes using JavaScript in ready
event (Assuming your form isnt dynamic), like this :
$(function () {
$("#input_id").attr("data-random", Math.random());
});
This will give a simulation to the browser that this is different element and hence won't bring the autocomplete data to the text box.
For dynamic input
, here's the jQuery way :
$("form").append($("<input />", {
"type": "text",
"class": "V_NAME",
"name": "V_NAME",
"id": "NAME" + array[l],
"autocomplete": "off",
"data-random": Math.random()
}));
Upvotes: 1
Reputation: 11114
This depend on browser Add this tag to textbox
This Property Supported by the Browser which showing values you've typed in that field before.
You can turn off this property by :
<form id="Form1" method="post" autocomplete="off">
<input type="text" autocomplete="off" id="input_id"></input>
...
</form>
Upvotes: 3