<p>I have a web application that is dynamically loading PDF files for viewing in the browser.
Currently, it uses "innerHTML" to replace a div with the PDF Object.  This works.</p>

<p>But, is there a better way to get the ID of the element and set the "src" or "data"  parameter for the Object / Embed and have it instantly load up a new document?
I'm hoping the instance of Adobe Acrobat Reader will stay on the screen, but the new document will load into it.</p>

<p>Here is a JavaScript example of the object:</p>

<pre><code>document.getElementById(`divPDF`).innerHTML = `&lt;OBJECT id='objPDF' DATA="'+strFilename+'" TYPE="application/pdf" TITLE="IMAGING" WIDTH="100%" HEIGHT="100%"&gt;&lt;/object&gt;`;
</code></pre>

<p>Any insight is appreciated.</p>

I am not sure if this will work, as I have not tried this out in my projects.
(Looking at your JS, I believe you are using jQuery. If not, please correct me)
Once you have populated the divPDF with the object you might try the code below:
```
```
$("objPDF").attr({
    data: "dir/to/newPDF"
});
```
```
Again, I am not sure if this will work for your particular needs but if you attach this code to an event handler you can switch out the data of the object.
You could also wrap it in a function to be used over and over again:
```
```
function pdfLoad(dirToPDF) {
    $("objPDF").attr({
        data: dirToPDF
    });
}
```
```