Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JavaScript]Błąd validatora, dlaczego?
Forum PHP.pl > Forum > Przedszkole
lamcpp
Sprawdzam poprawność strony w validatorze:
http://validator.w3.org

  1. <script type="text/javascript">
  2. $(document).ready(function(){
  3. $('a[href="#"]').click(function(){
  4. $('#tags').attr('innerHTML','<div class="loading"></div>');
  5. $('#tags').load('index.php?action=tags&id='+$(this).attr('id'));
  6. return false;
  7. });
  8. });
  9. </script>


Pojawia się błąd:
Cytat
Line 197, Column 65: document type does not allow element "div" here
$('#tags').attr('innerHTML','<div class="loading"></div>');

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).


Pytanie, jak temu zaradzić? Czy dobrze rozumiem, ze w elemencie a nie moze byc elementu div? Jak to zamienic?
Gość
Czy nikt nie wie?
PrinceOfPersia
a tez masz podobny problem jak ten uzytkownik (temat zalozony rok temu w koncu...)?
przypuszczam, ze nalezaloby przeniesc kod do oddzielnego pliku *.js, bo zapewne parser probuje sparsowac bracketsy (< oraz >) .

To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.