Is this possible? Something like : Pseudo code - createElement("myCustomHTML"). And then you can style myCustomHTML in your CSS. Usage: <myCustomHTML></myCustomHTML> which would pull styling in from CSS and be used in jQuery selectors?
1 Answer
This will work fine; this is how HTML5 elements are used in older browsers.
However, IE won't apply CSS to the elements until you call document.createElement("elementName").
This is what the HTML5 Shiv does.
5 Comments
benhowdle89
Oh ok, how do i do it then? Or did i inadvertantly write it in my pseudo code?
Josh K
@benhowdle: He's talking about IE6, which is (hopefully) an unsupported browser at this point.
SLaks
@Josh: Actually, all IE versions, except maybe IE9.
SLaks
@ben: In IE, call
document.createElement("tagName") once. Then (or in real browsers), just use the element.Josh K
@SLaks: Ah, I didn't know that. My question is why not us a
<div> with an id?