Hope this is possible. I tried. HTML code and text files are in the same folder.
Here is the jQuery part.
$(document).ready(function() { $("select").change(function() { file_name = $("select").val(); $('#span_result').load(file_name); }); });
HTML code
<select class="sel" name="files"> <option value="">Select a file</option> <option value="file.txt">file.txt</option> <option value="file2.txt">file2.txt</option> <option value="jQuery_file.html">jQuery_file.html</option> </select><br> <p>Contents of the file will be displayed below</p> <div id="span_result"></div>
This worked for me in firefox. Sorry if you failed.
Kishore k
source share