Note that there are some explanatory texts on larger screens.

plurals
  1. POfoo.substr gives "Is not a function" error
    primarykey
    data
    text
    <p>I'm using Jquery's datepicker plugin (which works fine). Then I need to extract the "day of the week" from the picked date. </p> <p>When using <code>foo.substring(0,3)</code> to assign the first three characters of the <code>datepicker('getDate')</code> I get: <code>TypeError foo.substr is not a function</code>. </p> <pre><code>$(function () { $("#textDatepicker").datepicker(); }); function selectedDay() { var foo = $("#textDatepicker").datepicker('getDate'); //IF USED.... alert(foo); //retuens (for example)..... //"Thu Jul 18 00:00:00 GMT-0400 (Eastern Standard Time)" var weekday = foo.substr(0, 3) document.getElementById("dayofweek").innerHTML = "The day of the week selected is: " + weekday; } &lt;head&gt; &lt;script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"&gt;&lt;/script&gt; &lt;script src="https://jquery-blog-js.googlecode.com/files/SetCase.js" type="text/javascript"&gt;&lt;/script&gt; &lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"/&gt; &lt;/head&gt; &lt;body&gt; Select Date:&amp;nbsp;&lt;input type="text" id="textDatepicker" onchange="selectedDay();"&gt; &lt;br&gt;&lt;br&gt; &lt;span id="dayofweek"&gt;Selected day of week replaces this&lt;/span&gt; &lt;/body&gt; </code></pre> <p>I have also pasted at: <a href="http://jsfiddle.net/Pvz4E/2/" rel="nofollow">jsfiddle</a></p> <p>Any help would be appreciated.. Thanks in advance...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload