javascript - jQuery selector: Firefox recognize but IE not -
this element custom attribute:
<input type="radio" status="b" name="opt_parent"/>
my script:
alert($(this).attr("status"));
alert($(this).attr("test"));
output:
firefox 3.0.10 --> "b" , "undefined"
ie 8.0.7600.16385 --> "true" , "undefined"
my observation:
ie return option button "checked state" true/false not custom attribute value. ie can detect whether custom attribute exist.
my question: how custom attribute value in ie?
this workaround ie, using outerhtml
var status = ($(this) .get(0) .outerhtml .replace(/^.+?\bstatus\s*=\s*(?:['"])(\w+).*$/, function(tag, valueattr) { return valueattr; })) || '';
Comments
Post a Comment