This was my second pass at an assignment given to me as part of a job interview. I decided to get a little flashier with this iteration. The brief was to have an upload utility that allowed a search term to be specified and a text file to be uploaded, with the contents of the uploaded file then displayed in the browser with the search term highlighted. My first pass was a purely PHP solution.
In this version, I decided to upload and display the file contents in the browser, then use jQuery and the jQuery highlight plug-in to highlight the search term.
Here is a JSFiddle of the “highlight” part:
See the demo here…