What happens if an invalid/nonstandard HTML attribute is used (for data)?
html
Solution
Unfortunately, this is not correct. However, all (modern) browsers will be okay with this (as far as being able to display it and keep it in the DOM) as they strive to be compatible with all (even the bad) HTML code, but it will not be a true attribute. Your code will not validate as true W3 specification HTML 5 code, but it should still work.
If you need to use 'city', you may want to use XHTML, where you can specify your own attributes to your own elements.
Problem
I have a strange question. However, I want to know what happen when I use invalid attribute on html 5? For example, if I want to add a attr 'City' on a tag. ``` <div data-city="etc"></div> ``` is the valid way. However, there is perfectly working fine with this way ``` <div city="etc"></div> ``` I want to know what is the result that I should not use `'city'` instead of `'data-city'`?? If only for use for passing data for javascrpit, can I use only 'city' in general?? Thank you very much for your advice.