-
Apr 18th, 2013, 10:21 AM
#1
[RESOLVED] html vs xhtml and using readonly
So - I've got input boxes that I make readonly like this
<input readonly type="text" class="awc-Refunds acs-edit-medium-text"/>
Been using these for a few months with no issues.
I just noticed that it's telling me in the IDE:
Validation (XHTML 1.0 Transitional): This attribute name must be followed by an equal (=) sign and a value. If the value is in quotation marks, the quotation marks must match.
Looking around the web I see that XHTML requires this to be
<input readonly="readonly" type="text" class="awc-Refunds acs-edit-medium-text"/>
Any problems with me changing this to the proper XHTML format.
I looked into the difference between HTML and XHTML - seems it's just evolving standards.
Is that all there is to it? Am I going to get burned by changing this??
-
Apr 18th, 2013, 11:05 AM
#2
Re: html vs xhtml and using readonly
Assuming you've set your doctype to XHTML, then setting it to readonly="readonly" is what should be done. At this point, the browsers are looking at your doctype, seeing only "readonly" and then checking other doctypes to see what to do with it.
Both would most likely work in all browsers and not cause any issues, but if you're using XHTML, readonly="readonly" is the correct form.
You'll also run into this scenario with checkboxes and radio buttons. For a checkbox, to make it checked by default, you can add "checked" to the element, but it should actually be 'checked="checked"', and radio button should be 'selected="selected"'.
-
Apr 18th, 2013, 11:09 AM
#3
Re: html vs xhtml and using readonly
I was sloppy too often - and didn't realize when looking up syntax online that HTML and XHTML are differing in these regards.
I'm going to clean all this up to use the XHTML format.
-
Apr 18th, 2013, 06:56 PM
#4
Re: html vs xhtml and using readonly
HTML5 allows three different specifications for some attributes. All three are equivalent:
HTML Code:
<input readonly type="text" class="awc-Refunds acs-edit-medium-text"/> <input readonly="" type="text" class="awc-Refunds acs-edit-medium-text"/> <input readonly="readonly" type="text" class="awc-Refunds acs-edit-medium-text"/>
http://www.w3.org/TR/html-markup/inp...attrs.readonly
In short, if you are using HTML5, you can safely ignore some of these IDE warnings.
-
Apr 18th, 2013, 09:02 PM
#5
Re: html vs xhtml and using readonly
If I use HTML5 - what does that mean different for one of my users?
Do they all of a sudden need a new version of a browser to access my page???
-
Apr 18th, 2013, 10:03 PM
#6
Re: html vs xhtml and using readonly
If I remember right, the X in XHTML was for "XML" ... which is a lot more picky about it's layout than HTML is.... XML doesn't allow for a value-less attribute, which is why you're getting the validation error.
Seeing as how <input readonly="readonly" is already supported by XHTML and seems to be supported by HTML (which I suspect doesn't care what the value is)... that's what I'd go with...
-tg
-
Apr 19th, 2013, 02:27 AM
#7
Re: html vs xhtml and using readonly
Originally Posted by szlamany
If I use HTML5 - what does that mean different for one of my users?
Do they all of a sudden need a new version of a browser to access my page???
Using HTML5 is basically just changing your doctype to:
Most of the new web-browser features are part of the HTML5 spec: Canvas, <video>, drag/drop, geolocation, web storage, file api, etc.
Just change your doctype, and start using them! Or feature-detect with Modernizr and use polyfills for older browsers.
Useful links: http://www.html5rocks.com/ http://html5boilerplate.com/ http://html5demos.com/ http://diveintohtml5.info/ http://caniuse.com/ http://html5please.com/ http://css3please.com/ http://mothereffinganimatedgif.com/ http://mothereffinghsl.com/ http://mothereffingtextshadow.com/
-
Apr 25th, 2013, 07:36 AM
#8
Registered User
Re: html vs xhtml and using readonly
An accurate professional website design has involvement of all above elements. Most of the web designers have to be capable of offering efficient technical and graphical web designs to the web sites and making the web design effective and efficient the web master should provide and use some techniques and tips for it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|