Note: The above function only work with visible input element. If you have hide the element with CSS property like
visibility: hidden; OR
display: none; then it will not work for that element.
It will copy the data from the hidden element.
Being Tricky 😉