Getting the User Agent with JavaScript

Solution 1:

Pure Javascript

document.getElementById('UserAgent').value = navigator.userAgent;
<input type="text" id="UserAgent">

jQuery

$('#UserAgent').val(navigator.userAgent);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<input type="text" id="UserAgent">

Solution 2:

Original Q didn't say anything about jQuery. so

document.getElementById('UserAgent').value = navigator.userAgent;