0

I am trying to create a bookmarklet that takes field names and copies them to my clipboard. I am getting the error back Expected an assignment or function call and instead saw an expression.

    function copy() {
  var number = document.getElementById('sys_readonly.rm_story.number').value,
      shortDescription = document.getElementById('rm_story.short_description').value,
      d = new Date(),
      year = d.getFullYear(),
      month = d.getMonth(),
      day = d.getDate(),

      name = year + month + day + ' - ' + number + ' - ' + shortDescription;

  name.select(),
  document.execCommand("copy");
}
Cody Smith
  • 127
  • 8

2 Answers2

0

You should use ; instead of , at the end of lines

Nick Prozee
  • 2,823
  • 4
  • 22
  • 49
0

Following up on your last comment

Possible duplicate, your problem is discussed in: JavaScript execCommand('copy') not working

Nick Prozee
  • 2,823
  • 4
  • 22
  • 49