Hi guys,
I'd like to get custom jQuery working with my silverstripe install. I'm making a tenders class and want to do a bit of custom form field validation, but before I can do that I need to get the requires working and then my code inside the $(document).ready function working.
Here's what I have in my TenderHolder.php file
class TenderHolder_Controller extends Page_Controller {
public function init() {
parent::init();
Requirements::javascript ('mysite/javascript/jquery-latest.js');
Requirements::javascript ('mysite/javascript/test.js');
}
}
And here's what I have in my test.js file.
(function($) {
$(document).ready(function(){
// your code here.
alert('wassup');
})
})(jQuery);
I've also tried this for the test.js file
$(document).ready(function() {
alert('hello world');
});
I know the requires are working because if I don't surround the alert in jQuery document ready tags then it'll make an alert appear.
Any ideas would be great appreciated!
Thanks!