2

May be it's duplicate question,

i see every page on stack overflow, for this type of error.

but didn't get my solution.

Here is my fiddle : https://jsfiddle.net/eua98tqa/6/

HTML:

<input type="button" value="SeeChange" onClick="javascript:AddDate(Date(), 3);return false;" />

jQuery:

function AddDate(AddedDate, DateToBeAdded) {
    var result = new Date(AddedDate);
    result.setDate(result.getDate() + DateToBeAdded);
    alert(result);
}

Note: works fine in my VS2015, FFConsole.

Bharat
  • 5,869
  • 4
  • 38
  • 58
  • 3
    https://jsfiddle.net/80x9dkmh/, You need to select _No wrap - _ option. You should go through [jsFiddle Documentation](http://doc.jsfiddle.net/) – Satpal Apr 15 '16 at 06:00
  • thanks satpal... i found that option and now my code is working, you can add this as your answer and i upvote it.. – Bharat Apr 15 '16 at 06:04
  • If it helped you, mark it as a solution, not just upvote. – cst1992 Apr 15 '16 at 07:30
  • actually @Satpal solved my issue, but as Tosif get time to view and answer, i upvoted it.. – Bharat Apr 15 '16 at 08:06

1 Answers1

0
<input type="button" value="SeeChange" onClick="javascript:AddDate(3);return false;" />
 <script>
  function AddDate(DateToBeAdded) {
    //setDate takes only one parameter
    var result = new Date();
    result.setDate(DateToBeAdded);
      alert(result)
    //o/p:Sun Apr 03 2016 12:05:20 GMT+0530 (India Standard Time)
  }
</script>
Tosif
  • 36
  • 5