0

I want to pass date today in javaScript function as a parameter, How I can do it? This is my code:

<button class="btn btn-danger" onclick="sendDate()"></button>
7
  • 3
    Can you provide a bit more showing what you have done so far along with an explanation as to what it is doing (or not doing) and what you expect it to do? Please refer to How do I ask a good question and How to create a Minimal, Complete, and Verifiable example Commented May 12, 2019 at 11:00
  • You can look up how to get the current date in JavaScript, right? Then you know how to pass a function argument, or no? Commented May 12, 2019 at 11:03
  • I know these things that you said Commented May 12, 2019 at 11:07
  • Just I want to pass today date in javaScript function Commented May 12, 2019 at 11:09
  • 1
    @MTCoster I solved that thank you Commented May 13, 2019 at 16:10

1 Answer 1

3

If you really want to pass the object you can use:

<button class="btn btn-danger" onclick="sendDate(new Date())"></button>

But, you can use new Date() to get current date-time in the javascript method as well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.