Eorutes Eorutes - 3 months ago 8
CSS Question

How to fix 2 types of W3C Validator Errors

This is my validator result

I need help fixing these 3 types of errors:


  1. " there is no attribute "

  2. " document type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag "

  3. " reference to entity "degerdiv" for which no system identifier could be generated "



Thanks in advance.

Answer

"there is no attribute"

This means you have used an attribute name that doesn't exist in the HTML specs. In your case it was on a <meta> tag. The only valid attributes for a <meta> tag are name, content, http-equiv, and charset.

"document type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag"

This means you have a <div> inside some element that doesn't allow a <div> according to the HTML specs. In this case, it is a <p> tag, which only allows these tags to be nested inside.

"reference to entity "degerdiv" for which no system identifier could be generated"

This is caused by an unencoded ampersand & triggering the HTML parser to search for an HTML entity with the name degerdiv. In your case, the location was inside your JavaScript code. This error can be ignored, or you can encode the ampersand as &amp;, or you can move your JS into an external file.

An additional solution is to use an object for the data value, as jQuery supports an object with key/value pairs as a readable alternative to providing a query string.

$.ajax({
  type: "POST",
  url: "fiyaturet.php",
  data: {
    deger: deger,
    deger2: deger2,
    sunucu: sunucu,
    degerdiv: degerdiv,
    degerdiv2: degerdiv2
  },
  success: function(ajax1cevap) {
    $('#fiyat').html(ajax1cevap);
  }
});