Can I write this javascript more efficiently with jquery?
Posted
by Haluk
on Stack Overflow
See other posts from Stack Overflow
or by Haluk
Published on 2010-04-10T21:22:24Z
Indexed on
2010/04/10
21:23 UTC
Read the original article
Hit count: 163
jQuery
Hi,
Do you think jquery could help me get the following script work faster? Thanks!
window.onload=function colorizeCheckedRadios(){
var inputs = document.getElementsByTagName("input");
if (inputs) {
for (var i = 0; i < inputs.length; ++i) {
if(inputs[i].checked&&inputs[i].type=="radio"){
inputs[i].parentNode.parentNode.style.backgroundColor='#FCE6F4';
}
}
}
}
© Stack Overflow or respective owner