/    Sign up×
Community /Pin to ProfileBookmark

Clear Text Field

Hi,

I have a page with consist of frames. Frame 1 consist of a text field, a submit button and a clear button. When the user types a keyword in the text field and clicks on the submit button a post method is call and the result of the search is display in frame 2 however the keyword is being left in sight in the text field. How can I clear the text field when the submit button is clicked?

to post a comment
HTML

2 Comments(s)

Copy linkTweet thisAlerts:
@ReisNov 01.2009 — Try this is the frame. Change the FORMNAME to the name of the form and INPUTNAME to the name of the input box. Then put clearText() in the insubmit section of the form:

<script>

function clearText() {

document.forms['FORMNAME'].INPUTNAME.value = '';

}

</script>

<form name="FORMNAME" onsubmit="clearText();">

<input type="text" name="INPUTNAME" />

</form>
Copy linkTweet thisAlerts:
@HyperdudeauthorNov 01.2009 — thanks that seems like the solution to my problem
×

Success!

Help @Hyperdude spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...