Q:

jQuery `find(selector)`: is there a way to reference each matched element?

I am using find(sel) to change css properties of all elements matched by sel: if the element has a position set, then it should get that position, otherwise it should get relative.
$("#mydiv").find("form").css({ "z-index": 2, "position": jQuery(this).css("position") || "relative", "background-color": "green" })

does not work.. best way to accomplish this?

A:

Try this variant of .css()
$("#mydiv").find("form").css({
    "z-index": 2,
    "position": function(){
        return jQuery(this).css("position") || "relative"
    },
    "background-color": "green"
})

