How to get custom javascript to run


https://forum.kartris.com/Topic6243.aspx
Print Topic | Close Window

By vswell - Sat 31 Oct 2015
Hi All-

I made a custom page that uses a jquery datepicker function and it was operational before adding kartris to my site. However, post-kartris, now it's not working. I tried adding the function to the <head> section of the template (which didn't work), and also tried making an external js. file that was referenced in the template. Has anyone had success in this area (or even ajax, etc)? I'm not too experienced with javascript. Here's the original function I used:

<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script type="text/javascript">
$(function () {
$("[id$=Box]").datepicker({
showOn: 'button',
buttonImageOnly: true,
buttonImage: 'https://jqueryui.com/resources/demos/datepicker/images/calendar.gif'
});
});

</script>

It basically adds a datepicker calendar to the text boxes of a datalist that have "Box" as part of their ID....

Thanks!
By Paul - Fri 27 Nov 2015
It's probably to do with jquery. Kartris uses jquery, so it might be your data picker uses a different version. I think it's possible to run two different jquery versions in a page if you google.