Some custom jQuery to autopopulate a text field via localStorage was used in a Content Editor on our NewForm.aspx page for a SharePoint 2010 list:

<script src="/.../jquery.js" type="text/j-avascript"></script>

<script type="text/j-avascript">
window.on-load = function(){
                window.setTimeout(readyCall, 1000);
}
function readyCall(){
     var piddata = localStorage.getItem('myPID');
$("#ctl00_m...TextField").focus();
$("#ctl00_m..._TextField").val(piddata);
}</script>

It's working as expected and auto-populating our field, but the top ribbon (especially the Attach File) in the ribbon was disabled.

The ribbon was finally enabled by using:

<script type="text/j-avascript">
$(document).ready(function()
{
   var e = $("input[id$='ctl00_m_g_..._TextField']");
   var piddata = localStorage.getItem('myPID');   
   e.val(piddata);   
});
</script>