jQuery css selector quirk
===

**Background:**

I have a CMS tool that allows users to create a table inside the content area.  If the option for a border is used, the tool sets the border attribute on the table, and does not use a style.  My reset stylesheet defaults all tables to no border, and this overrides the table border attribute (i.e., no border is displayed).

As a quick hack, I put in some jQuery to grab table elements that have a non-0 border attribute and convert the border attribute into an inline style.

**My question:**

While I was able to get the code to work, it is not the solution I originally intended.

This is currently working:

        $("table[border!='0']").css('border', function() { 
             return $(this).attr['border'] + "px solid"; 
        });

My original solution was to not require the function in the css method - 

    $("table[border!='0']").css('border', $(this).attr['border'] + "px solid");

I realize as I write this question that $(this) doesn't refer to each item in the selection, as it does inside the function, thus my problem.

[jsFiddle][1]

Is there a way to accomplish this without the function?


  [1]: http://jsfiddle.net/eMan5/3/