title: Adding placeholder attribute using Jquery
body: <p>I have a simple problem. I just want to add a placeholder on an input. Here's the code:</p>
  
  <pre><code>HTML:
  &lt;input type="text" name="link" class="hidden"&gt;
  
  JQuery:
  var link = document.querySelector('.link');
      link.style.display='block';
      link.classList.remove('hidden');
      if(val === 1)  // for a movie
          link.classList.add('placeholder="Add Movie Title. ."');
      else  // for an external link
          link.classList.add('placeholder="Add External Link . ."');
  </code></pre>
  
  <p>As you can see, the placeholder doesn't work because the syntax is wrong. I searched related solutions to my problem but they use a different method like this</p>
  
  <pre><code>$("").attr("placeholder", "Type here to search");});
  </code></pre>
  
  <p>but I need something that is similar to what I used with adding style, but I'm not sure if there's other way to do it. Is there a similar way?</p>