Note : This method works well in the Internet Explorer.
Description of code :
Very first line of the function creates a textValue variable which holds the element reference to the specified text range. In the second and third line we have checked the condition that whether created duplicate copy of text field value is empty, if it is empty it will float an alert message that "No text to display". Full html code for this example is given as below :
Page will be like as below :
Input some text into text field to create a duplicate copy of it and press button "Create Duplicate String".