I'm trying to do the following:

<SCRIPT>
$(document).ready(function(){
        $.fn.toggleCSS = function(property,value) {
                return this.each(function(){
                        var p = $(this).css(property);
                        if(p) { $(this).css(property,""); } else { $
(this).css(property,value); }
                });
        }
        $("#testme").click(function() { //let's test out our function...
                $(this).toggleCSS("font-weight","bold");
        });
});
</SCRIPT>
<input type="button" ID="testme" value="click me!">


in this case, p returns as '400'.


.css() seems to always return default values, even if I don't declare
them explicitly. Even if the button in question is a span. Originally
I thought this _wasn't_ the case, as I've run into problems with
jQuery trying to set values for properties that haven't been
previously declared.

I'm guessing my approach to this function is probably not going to
work. Any suggestions?


-adam

Reply via email to