Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Little things like search field onclick


Go to End


2 Posts   2024 Views

Avatar
cnyaviary

Community Member, 12 Posts

4 March 2009 at 3:40pm

How would I go about putting code to seach field onclick? Like currently, the default term is 'Search' and what i am trying to do is clear that field on click. Or where to change so that the search field is blank by default. Any pointers would be helpful. Thanks,

George

Avatar
Sam

Administrator, 690 Posts

4 March 2009 at 4:22pm

I would recommend that you use jQuery for this. Any jQuery tutorial should be able to guide you through that.

To get your javascript files into your site, put code like this into the init() method of the Page_Controller class.

Requirements::javascript('jsparty/jquery/jquery.js');
Requirements::javascript('mysite/javascript/searchExtras.js');