Hi guys I was just wondering what (i, val) means in this function and what it is passing?
function boldToggler(itemid) {
$(itemid).css("font-weight", function(i, val) {
return val == "bold" ? "normal" : "bold";
});
}
Any help would be greatly appreciated!
From
.css( propertyName, function(index, value):For example, suppose you had the following HTML:
And you execute:
function(i, val)will be executed once for eachdivelement. In the first execution,iwill be 0, andvalis the old value of thefont-weightproperty, that is,normal. In the second,iwill be 1, andvalis the old value of thefont-weightproperty, that is,bold.