n0sleeves Posted May 27, 2014 Share Posted May 27, 2014 I'm receiving "failed to execute querySelectorAll on Document". What is that error and how do I fix it? Been researching google :/ No luck Link to comment Share on other sites More sharing options...
felix Posted May 27, 2014 Share Posted May 27, 2014 how about some actual code? 2 Link to comment Share on other sites More sharing options...
kongondo Posted May 27, 2014 Share Posted May 27, 2014 Well, seems like you already got an answer at SO. I must admit though, your question here was rather vague in comparison to the details you offered across the pond 3 Link to comment Share on other sites More sharing options...
n0sleeves Posted May 28, 2014 Author Share Posted May 28, 2014 OMG. I can't believe I forgot to include the code here I was rushing. My apologies. Below is the code, however, I have already received answer at Stack Xchange as kongondo has pointed out. However, just for reference for anyone here, I have included the problem in more detail and the solution The solution was to insert some letters in front of the ID numbers. Apparently - querySelectorAll doesn't like number-only (or leading-digit) ids. **What I was doing:** I have links generated from a PHP array which produce it's own unique ID which should point to it's own modal (popup window) div which has a matching ID to the link ID. The modals are also auto generated using a PHP array. I am receiving this error, which I am very unfamiliar with (noob). Not sure how to fix. The modal isn't working and I am using Foundation 5's reveal plugin. **PHP LINK ARRAY:** //more code above if ($track->lyrics != null) { // If lyrics field isn't empty $html .= '<a href="#" class="lyricCLicked" data-reveal-id="' . $track->id . '">Lyrics</a>'; $numTracksContainingLyrics++; foreach ($track as $value) { $lyricsArray[$track->id] = $track->lyrics; } } **MODAL DIV ARRAY** foreach ($lyricsArray as $key => $value) { $lyricModal = '<div id="' . $key .'" class="reveal-modal" data-reveal>'; $lyricModal .= $value; $lyricModal .= '<a class="close-reveal-modal">×</a>'; $lyricModal .= '</div>'; echo $lyricModal; } The Results are being written to HTML source. So, the arrays are working and generating. It's just giving me this "***Failed to Execute querySelectorALl on Document : #1042 is not a valid selector***. By the way, "1042" is one of the unique IDs being generated in case you were wondering. Link to comment Share on other sites More sharing options...
Recommended Posts