I'm trying to change the text of a label in html to show the file uploaded to the input element that the label points to. I found this javascript code and changed it a little to fit my html. It's not breaking my page but it's not displaying the file name either and I haven't seen this red bar before so I'm wondering if it has something to do with that, or more generally, why the bar is appearing in the first place. Thanks in advance for any tips!
Why does a red bar appear in my javascript code when working in sublime
3.2k Views Asked by Rebecca Collins At
2
There are 2 best solutions below
Related Questions in JAVASCRIPT
- Using Puppeteer to scrape a public API only when the data changes
- inline SVG text (js)
- An array of images and a for loop display the buttons. How to assign each button to open its own block by name?
- Storing the preferred font-size in localStorage
- Simple movie API request not showing up in the console log
- Authenticate Flask rest API
- Deploying sveltekit app with gunjs on vercel throws cannot find module './lib/text-encoding'
- How to request administrator rights?
- mp4 embedded videos within github pages website not loading
- Scrimba tutorial was working, suddenly stopped even trying the default
- In Datatables, start value resets to 0, when column sorting
- How do I link two models in mongoose?
- parameter values only being sent to certain columns in google sheet?
- Run main several times of wasm in browser
- Variable inside a Variable, not updating
Related Questions in SUBLIMETEXT
- Need 10 seconds to execute "Hello World"
- Why does the .exe file become locked after compiling?
- Move Sublime Text find panel
- Program runs in sublime text editor but not in terminal
- sublime text editor setup problem for c++ language
- Sublime Text is unable to run Python code
- Secure channel error when installing packeges in Sublime Text
- treating as linker script
- Debugging Ajax/XmlHttpRequests using Xdebug on Sublime
- Sublime don't want to find words with only a few letter match
- How Can I Fix Sublime Text CSS Style italic to Normal?
- How can I use typewriter mode in sublime text4?
- What command to use to send code to R console through AppleScript?
- Sublime Text 4: How to highlight C++ class/struct names and typedef, using and #define aliases?
- How scroll in sidebar keyboard Sublime Text
Related Questions in EXPRESSIONENGINE3
- ExpressionEngine Subscriptions Add-on: Unable to Integrate PayPal for User Subscriptions
- Why does a red bar appear in my javascript code when working in sublime
- No English Abbreviation for Transcribe EE Plugin
- ExpressionEngine 3 - parent/child category set up using 2 separate category groups
- How to change the meta tag title of the homepage in expressionengine?
- Expression Engine 3 pagination with page_uri
- ExpressionEngine & Taxonomy 3 - How to split nodes into blocks of 5?
- Expression Engine 3 - Entries Tag - page_uri empty
- How to link to an entry in a channel in expressionengine?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?

The red section is a syntax highlight telling you that based on the rules laid out in the syntax definition for whatever language or file type you're using, the text that appears here is not valid. This is something that the syntax definition in use provides, so it doesn't appear in all file types (it relies on the syntax author) and will occur no matter what third party packages such as Linters you might have installed.
The line of code that's doing this is:
The syntax highlighting is giving you 3 different hints here as to what's going wrong (and here on SO the syntax highlighting is providing similar clues):
).pop();is yellow, which indicates that it's a string, but it doesn't look like it should be a string at all (technically, you can see that it's the same color as the string in the line above but not the same color as the other function calls likesplit())\'sequence is purple, which indicates that this is being interpreted as acharacter escape(here we can see that the color of that text is different from what we would expect the content of a string to look like).Taken all together, the
\'doesn't end the string in the argument tosplit()like you think it does; the string constant continues past there to the end of the line, and since the end of the line is reached without the string being closed, that line is broken.So, you need to fix the
split()call argument to be a valid string. Probably you meant it to be either'\\'(you want to split the string at backslashes) or'\''(you want to split the string at single quotes).