Struggling to make the jQuery timepicker plugin work on my JSP page

Hi everyone, I'm having trouble getting a jQuery plugin called timepicker to work. I already have a datepicker setup and running smoothly. I've spent hours researching this issue and trying different plugins. Here's my process: I download the plugin, import the .js file into my project's resources/js folder (I'm using Spring), copy the .css file for the timepicker into the resources/css folder. Then, I add a script below the one that imports the standard jQuery library to incorporate the plugin. Below is how I implemented it. Thank you for any help!

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" %>
...
    </div>

Answer №1

It seems that the HTML elements you are trying to apply the datepicker to are not present in your JSP file.

Answer №2

Thank you for the code update.

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" %>
<html>
<head>
<title>Updated Home Page</title>
<link rel='stylesheet' type='text/css' href='<c:url value="/resources/css/styles.css" />' />
<link rel='stylesheet' type='text/css' href='<c:url value="/resources/css/jquery-     ui-1.10.3.custom.min.css" />' />
<link rel='stylesheet' type='text/css' href='<c:url     value="/resources/css/jquery.timepicker.css" />' />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>></script>

<script src='<c:url value="/resources/js/jquery-ui-1.10.3.custom.min.js" />'></script>
<script src='<c:url value="/jquery.timepicker.min.js" />'></script>

<script type="text/javascript" src="js/jquery.timepicker.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.timepicker.css" />

<script type="text/javascript" src="lib/base.js"></script>
<link rel="stylesheet" type="text/css" href="lib/base.css" />

<script>
$(function() {
  $("#dateStart").datepicker();
  $("#dateEnd").datepicker();
});

$(function() {
    $('timestart').timepicker();

  });
</script>

</head>
<body>
<div id='header-container'>
<div id='header-content'>
    <a href='<c:url value="/" />'>New Website</a>
    <div id='header-content-right'>
        <a href='<c:url value="/signout" />'>Logout, ${ user.email }</a>
    </div>
</div>
</div>
<div id='body-content'>
<h1>
    Event Creator
</h1>
<c:if test="${!empty username}">
    ${username = "User"}
</c:if>
<h3>
    Hello, ${username}
</h3>
<form action='<c:url value="/createEvent" />' method='post'>
    <p><input type='text' name='eventTitle' size='58' placeholder='Enter Title' /></p>
    <p><input type='text' name='eventLocation' size='58' placeholder='Enter Location' /></p>
    <p><textarea name='description' rows='5' cols='42'     placeholder='Description'></textarea></p>
    <p>From<input type='text' name='dateStart' id='dateStart' /> <input id="timestart"     type="text" class="time" /> to <input type='text' name='dateEnd' id='dateEnd' /></p>
    <p><input type='checkbox' name='allDay'> All day event</p>
    <p><input type='checkbox' name='repeat' id='repeat'> Repeat Event</p> 
    <p><input type='submit' /></p>

</form>


</div>
</body>
</html>

Answer №3

Upon loading the jsp page, I noticed this message appearing at the bottom of the console. Much appreciated.

WARNING : org.springframework.web.servlet.PageNotFound - Unable to map HTTP request for URI [/calendar/jquery.timepicker.min.js] in DispatcherServlet named 'appServlet' WARNING : org.springframework.web.servlet.PageNotFound - Unable to map HTTP request for URI [/calendar/js/jquery.timepicker.js] in DispatcherServlet named 'appServlet' WARNING : org.springframework.web.servlet.PageNotFound - Unable to map HTTP request for URI [/calendar/css/jquery.timepicker.css] in DispatcherServlet named 'appServlet'

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

When hovering, apply style 1 to all elements with the same id, and style 2 to the hovered element

I'm working with some user-generated divs that I want to dynamically highlight when hovered over, while simultaneously blurring the other divs. My challenge is figuring out how to change the style of the hovered div separately from all the others. Th ...

Is there a way to reorganize the image/text grid using a media query?

In my grid, each row contains text in one column and an image in the other. The order of these columns is determined by the user in a CMS and can vary for each row. https://i.sstatic.net/MwR5O.png On mobile devices, I always want the image to appear abov ...

My Vue.js modal component isn't functioning as expected

I have a Vue JS modal component that is supposed to display all the names typed in the form, but it isn't working. As a newcomer to Vue JS, I'm having trouble understanding why it's not functioning properly. Additionally, I am unable to use ...

List items not appearing inline

I'm having an issue with displaying a list of movies from my database. Instead of showing inline as intended, they are appearing vertically. I've tried using both inline-block and inline for the li elements, but so far nothing has worked. Any ass ...

Employing jQuery to implement a hover animation on IE9, it functions properly when hovering over but exhibits strange behavior upon exiting

My website features a quote box positioned to the right of the browser. When hovered over, it reveals a list of available dates. I initially tried using CSS transitions which worked on all browsers except for IE - no surprise there. So, I turned to jQuery ...

Using canvas to smoothly transition an object from one point to another along a curved path

As a beginner in working with canvas, I am facing a challenge of moving an object from one fixed coordinate to another using an arc. While referring to the code example of a solar system on https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutori ...

Reloading data in Angular using jQuery DataTables

After successfully implementing the jQuery datatables library, I encountered an issue where new data retrieved from my API was not displaying inside the datatable as expected. Instead, it was being shown below the table using ng-repeat. It seems that the d ...

`Exploring the magic of CSS image overlay feature`

I would appreciate it if you could walk me through the implementation of this overlay code... .overlay { position: absolute; top: 0; bottom: 0; left: 0; right: 0; height: 100%; width: 100%; opacity: 0; transition: .5s ...

Loading SVGs on the fly with Vue3 and Vite

Currently, I am in the process of transitioning my Vue2/Webpack application to Vue3/Vite. Here's an example of what works in Vue2/Webpack: <div v-html="require('!!html-loader!../../assets/icons/' + this.icon + '.svg')" ...

<a href> hyperlink with the web address as the anchor text

Can a hyperlink be generated using a variable instead of typing in static text like CLICK HERE, so that it displays the full URL of the page specified in the a href tag, regardless of the URL? < a href="http://sourceforge.net/projects/tcpick/,">CL ...

How can I implement a redirect back to the previous query page post-authentication in Next.js 13?

To enhance security, whenever a user tries to access a protected route, I plan to automatically redirect them to the login page. Once they successfully log in, they will be redirected back to the original protected route they were trying to access. When w ...

textarea and other inputs failing to retain data previously entered

I am facing an issue with inserting values from a text area into my database. When the form redirects to the JSP file responsible for insertion, the values returned are null. I find it perplexing because the same process works fine for registering. Below ...

Using Jquery to trim the data returned from the server response

Utilizing asp.net for obtaining the server response via JQuery AJAX in JSON format has been my approach. I've experimented with both JQuery.getJSON() and typical jQuery response methods, followed by conversion to JSON format using $.parseJSON. Howeve ...

Tips for avoiding HTML injections in HTML tooltips

I'm attempting to create a tooltip using HTML, but I need to escape specific HTML elements within it. So far, my attempts have been unsuccessful. Take a look at the example I've provided: http://jsfiddle.net/wrsantos/q3o1e4ut/1/ In this example ...

Uncovering specific content within an html document with the help of BeautifulSoup

I am currently working with a code that involves using BeautifulSoup to scrape text from elements with the class 'product'. However, I am only interested in extracting the 2nd and 4th values ('Product 2' and 'Product 4') to be ...

Unable to calculate height properly when using the formula height: 70% + 0px

My attempt to set the height of a div element to 70% using CSS3's calc() function has been unsuccessful. While specifying viewport height (70vh) works, I specifically need the height to be 70%. .scroll-inner-container { height: -moz-calc(70vh + 0 ...

Is it possible to leverage the dimensions (width and height) of an element in JavaScript to obtain a zoom scale?

Currently experiencing an issue with the zoom level in d3.js I obtained the dimensions for the <g className ="_zoomElement"> element using this function const g = select("._zoomElement") console.log(g.node().getBBox()) My ...

Why is the bootstrap modal not showing up when editing the data?

I am currently working on a Blazor application with .NET Core 7. I am facing an issue where the Bootstrap modal does not display as active when clicking the edit button. When trying to edit data using the Bootstrap modal, the modal does not display as act ...

Having trouble with sending a post request through ajax

Whenever I try to initiate an Ajax request upon clicking a button, the request never seems to get executed. Below is the snippet of my HTML code : <!DOCTYPE html> <html lang="en"> <head> <title>User Form</title> ...

After consolidating buffer geometries, adjusting the transparency/opacity of the shapes is not an option for me

I've been working on a model with multiple boxes and trying to optimize draw calls by using buffer geometry merger. However, I'm facing an issue where I can't change the opacity of geometries after merging. Here are the things I've tri ...