3 ms·
You can achieve the same effect now using XHTML namespaces. I defined <question:required>, <question:optional>, <question:subquestion>, <answer:trigger> tags w
by byoung2 17y ago
You can achieve the same effect now using XHTML namespaces. I defined <question:required>, <question:optional>, <question:subquestion>, <answer:trigger> tags when working on a dynamic survey application I did that would hide or display followup questions based on answers to previous questions.
- bbx 17y agoI'm quite interested in how you use it. Do you have an example?
- smanek 17y agoSame way you use namespaces in any other XML document. Do something like: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:question="http://www.my.unique/ns/question"> ... I love being able to use pure SVG markup in XHMTML just by having it in a separate namespace (of course, there is trouble in IE land ...)
- byoung2 17y agoExactly like smanek described to define the tags. Then you use them like this: <question:required> <question:text> Would you recommend us to a friend? </question:text> <answer:choice> <input type="radio" value="Yes"> </answer:choice> <answer:trigger> <input type="radio" value="No"> </answer:trigger> <question:subquestion question:trigger="No"> Please explain why you wouldn't recommend us: ... </question:subquestion> </question:required> I then used jQuery to bind events to the newly created tags to hide/display subquestions based on the response, and css to style it.
- nkohari 17y agoMaybe this is a dumb question, but do you have any problems with cross-browser support for that situation? I'd love to try this out in my app -- div soup is a killer.
- byoung2 17y agoUsing the namespace and jQuery there was no problem in IE6/7, FF 1.5/2, Safari, Chrome, and Opera 8 (this was in 2008)