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.

General Questions /

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

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

Little things like search field onclick


Reply


2 Posts   1406 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, 685 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');