I would like to use jQuery to replace the contents of an HTML tag with a file.
I have the following code: $("html").html(hi.html)
.
While it works if I instead put a quote, it doesn't work if I put a file. How do I achieve this?
I would like to use jQuery to replace the contents of an HTML tag with a file.
I have the following code: $("html").html(hi.html)
.
While it works if I instead put a quote, it doesn't work if I put a file. How do I achieve this?
Your question seems a bit ambiguous. I am assuming you are trying to load a local file rather than a file served from a server. If you are looking for later, then gregg's answer will suffice.
You can use html5's File reader api to read contents of a file stored locally on your machine. Sample implementation: How to open a local disk file with Javascript?.
Helpful links:
Hope this helps if this is what you are looking for.