0
  1. I am using HTML controls to get interact with SharePoint 2013 list And performing CRUD operations using JSOM between forms and lists
  2. My form is having HTML date control.And on the submission of it, the form need to fetch the month name.

Can any one help me how can I get the month name using HTML date control?

1 Answer 1

0

Below code will help you to get month.

var d = new Date();
var n = d.getMonth();

You can assign the value to var d from the HTML date control's output (like var d = inputdateObject.value)

Please note that month number starts from 0 like 0=January, 1=February etc. Than after you can replace the month as per the number in your output.

3
  • Thanks for your support.The below written code is not going fine with IE browser .Can any one help me <!DOCTYPE html> <html> <body> <input type="date" id="myDate" > <button onclick="myFunction()">Try it</button> <script> function myFunction() { var x = document.getElementById("myDate").value; alert(x); } </script> </body> </html>
    – MSA
    Commented Apr 21, 2016 at 5:40
  • input elements with type="date" are not supported in Internet Explorer or Firefox
    – Hardik
    Commented Apr 21, 2016 at 6:17
  • 1
    You can check all control's compatibility here ...developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms/…
    – Hardik
    Commented Apr 21, 2016 at 6:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.