Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
68
rated 0 times [  71] [ 3]  / answers: 1 / hits: 16440  / 12 Years ago, wed, august 29, 2012, 12:00:00

I have a form that when buttons are clicked, it enters a value into an input field. I want to add another button that deletes the last character added. How would I accomplish this using jQuery


More From » javascript

 Answers
6
<script>
function addTextTag(txt)
{
document.getElementById(text_tag_input).value+=txt;
}
function removeTextTag()
{
var strng=document.getElementById(text_tag_input).value;
document.getElementById(text_tag_input).value=strng.substring(0,strng.length-1)
}
</script>

<input id=text_tag_input type=text name=tags />

<div class=tags_select>
<a href=javascript:addTextTag('1')>1</a>
<a href=javascript:addTextTag('2')>2</a>
<a href=javascript:addTextTag('3')>3</a>
<a href=javascript:removeTextTag()>delete</a>
</div>​


Used a modified version of your code itself try


[#83344] Tuesday, August 28, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
braeden

Total Points: 231
Total Questions: 96
Total Answers: 86

Location: Somalia
Member since Mon, Dec 28, 2020
3 Years ago
;