Why is obj.attr(....) undefined?
<pre><code>function getSelectedOptionPrice( obj ){
    function getOptionPrice( spconfig, attributeId, optionId ){
        var optionsArr = spconfig.config.attributes[attributeId].options;

        for ( var i=optionsArr.length-1; i&gt;=0; --i ){
            if ( optionsArr[i]['id'] == optionId )
                return parseFloat( optionsArr[i].price );
        }

        return 0;
    }

    var attributeId = obj.attr('id').match(/\d+/);
    attributeId =  parseInt( attributeId[0], 10);
    var optionId = parseInt( obj.val(), 10 );

    return getOptionPrice( spConfig, attributeId, optionId );
}
</code></pre>
