Get value for joomla calendar input box to use in ajax call

by user1616338   Last Updated October 13, 2019 19:10 PM - source

I have a joomla calendar set up:

        defined('_JEXEC') or die;
        echo '<div id="calendarBoxes"  >';
        echo '<div id="datereceived1" class="datereceived1" >';
        echo JHtml::calendar(date("d/m/Y"),'dateReceived','dateReceived' , '%d-%m-%Y');
        echo "</div>";

This works fine and shows the calendar which then populates the box correctly.

I need to get the populated value so that I can use it in an ajax call to save it to a database.

I'm doing this:

stock.datereceived = jQuery( "#dateReceived" ).val();

but this returns nothing.

I looked at the code inspector and I can see the value:

<input type="text" id="dateReceived" name="dateReceived" value="" data-alt-value="13-10-2019" autocomplete="off" data-local-value="13-10-2019">

but I can't access the data. I can't use


And I can't find any getter or setter for the calendar.

Any help would be great. thanks

Related Questions

joomla calendar field issue

Updated March 13, 2019 11:10 AM

Populate Joomla Calendar field by jQuery not working

Updated September 30, 2017 16:10 PM

Calendar Field Type

Updated August 24, 2016 08:04 AM

Joomla Calendar for versions >3.7

Updated January 30, 2018 17:10 PM