How to Select Text in an Element (akin to highlighting with your mouse) on newly created ajax content?
<p>I'm using the <code>selectText</code> function from here <a href="http://stackoverflow.com/a/987376/784637">http://stackoverflow.com/a/987376/784637</a></p>

<p>However when I called this function immediately after an ajax request on the newly created element:</p>

<p><code>selectText('some-newly-added-element')</code></p>

<p>I get the following error in firebug</p>

<pre><code>NS_ERROR_DOM_NOT_OBJECT_ERR: Parameter is not an object
[Break On This Error]   

range.selectNodeContents(text);
</code></pre>

<p>Note that I am able to call this function after the ajax request on the same element like so </p>

<pre><code>$('#container').on('click', '#some-newly-added-element', function(){
   selectText('some-newly-added-element');            
});
</code></pre>

<p>Is there a way to call this function immediately after the ajax request is done?</p>
