title: Inserting a link to a dupe in the close popup here on Stackoverflow
body: <p>I'm working on some code to insert a link to a dupe in the SO close question popup:</p>
  
  <p><img src="https://i.stack.imgur.com/WWKEr.png" alt="Close as dupe"></p>
  
  <p>What happens when you manually insert a link to a question in the textbox is that some JS kicks in and fetches the question belonging to the URL. However when I insert an URL using javascript (Chrome extension) into the textbox the SO javascript never kicks in to retrieve the question. The code I am using to insert the URL of the dupe is:</p>
  
  <pre><code>$(document).on('click', '.cvhelper-dupelist li', function() {
    var url = $('a', this).attr('href');
    var $dupeBox = $('#duplicate-question');
  
    $dupeBox.val(url);
  });
  </code></pre>
  
  <p>The above code successfully inserts the link in the textbox, however for some reason the SO javascript never kicks in to retrieve the question.</p>
  
  <p>I've also tried the following to maybe force it to no avail:</p>
  
  <pre><code>$dupeBox.change();
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$dupeBox.keyup();
  </code></pre>
  
  <p>To test what is happening you could open up the close as dupe popup (as above) of a random question and run:</p>
  
  <pre><code>$('#duplicate-question').val('http://stackoverflow.com/questions/8028957/headers-already-sent-by-php');
  </code></pre>
  
  <p>in the browsers console.</p>