Preview issue; suddenly stopped working mid project

Tell us what’s happening:

Anyone else’s Preview Pane suddenly become disconnected?

It appears to be affecting most lessons and on two different browsers…

I can get it to come back by removing all javascript but upon re-adding the preview page is unresponsive. Help :frowning:

Sometimes that can be caused by errors in code. Could you share it?

Of course,

const userInput = document.getElementById("user-input")
const check = document.getElementById("check-btn")
const clear = document.getElementById("clear-btn")
const results = document.getElementById("results-div")





const choice = () => {
  if(userInput.value === "") {
    results.innerHTML = "Please provide a phone number"

    


  } else 
  validNumTest(userInput.value)
  ? valResult = "Valid US number: " + userInput.value  :
  valResult = "Invalid US number: " + userInput.value;
  results.innerHTML += valResult + `<br />`;
  valResult = ""
  ;
  
} 




let valResult = ""
const regexMin = /^\d{3,3}\s?-?\d{4,4}$/
const regexLong = /^\(?\d{3,3}\s?-?\)?\d{3,3}\s?-?\d{4,4}$/
const regexMax = /^[1]\s?\(?\d{3,3}\s?-?\)?\d{3,3}\s?-?\d{4,4}$/

\\Ver 2

const regexSpace = /^[1]\s?\d{3,3}\s?\d{3,3}\s?\d{4,4}$/
const regexHyphen = /^[1]-?\d{3,3}-?\d{3,3}-?\d{4,4}$/
const regexPar = /^[1]\s?\(\d{3,3}\)\s?\d{3,3}\s?\d{4,4}$/


const validNum = []

const validNumTest = (input) => validNum.some((regex) => regex.test(input))
//console.log("hi")
;



const clearArr = () => {
  results.innerHTML = ""
  userInput.value = ""
}






clear.addEventListener("click", clearArr)

check.addEventListener("click", choice)

Please let me know if the HTML and CSS would be of use.

Also,

It looks like other lessons I have already completed have the same issue now.

-building spreadhseet
-building number sorter
-decimal to binary

three randomly picked examples. preview is just white

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

Thank you for this, I backslashed rather than back ticked

Good news, I found the issue in my code that was causing it based on your theory. I had two backslashes that were meant to be forward slashes that were causing the issue. Not sure how it spanned and broke multiple lessons but that was definitely the issue. Thank you for your help :slight_smile:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.