How can I set default values for background-color and border css with Jquery?

Viewed 3351

I have some inputs which I modify their css with Jquery and I want to get their default css. I know that a method exists in Jquery to change the css (.css) and the property initial uses to make your html element show as default so according to their examples I wrote the following code:

$(document).ready(function() {
     var styles= {
         border : "initial",
         backgroundColor: "initial"
     };

     $('#code').css(styles);
});

but neither border or backgroundColor changes their values to their default css values.

Am I missing something? It is another property like initial to get their default css values for border and background-color?

EDIT: Here it is the HTML related with that input.

<input id = 'code' type='text' value = 'Prove' style = 'border: 0px; background-color: transparent;'/>

EDIT2: Here it is the jsfiddle in which you can see how I want the input (code2) and how the input it is being shown (code1).

Thanks in advance!

5 Answers
Related