/    Sign up×
Community /Pin to ProfileBookmark

Search term to stay in search field after search

Hello.

I have a search field on the website, and when I type a word to search, it search good, but after preforming the search, the search term from search text field disappears and become the default ‘Search’ word.

How can I make search term stay in search field after preforming a search ?

For example, when I type into the search field ‘JavaScript’ I want that term to stay in search field and after the search is done.

Thank you in advance.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@WolfShadeDec 10.2010 — If you are developing in a dynamic language like PHP, ASP, or ColdFusion, it's simple - just set a session variable with that value and set the session variable as the default value of the search field.

If you're not using a dynamic language, you could use JavaScript to set a cookie with that value, then on page load look for the cookie - if it exists, get the value and use JavaScript to set the value of the field with the cookie value.

^_^
×

Success!

Help @nokia6630 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 5.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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...