I am trying to change CSS of a button on blur. I suspect it might be a concatenation issue but am unable to figure out what I am doing wrong. Here is my code...
HTML
<input type="text" value="blue" id="textinput">
<button>Button</button>
<span id="color">red</span>
CSS
button {
background-color:blue;
background-image: -webkit-linear-gradient(top, white 0%, black 100%);
}
jQuery
$("#textinput").blur(function () {
setTimeout(function () {
endColor = $("#textinput").val();
$('button').css({
'background-color' : endColor
'background-image' : '-webkit-linear-gradient(top, #309ACB 0%,' + endColor + '100%)' });
}, 500);
});
FIDDLE LINK
http://jsfiddle.net/krishollenbeck/p2jah/20/
It works fine when I remove the gradient CSS. So I am guessing I am concatenating the variable wrong. However I have tried it multiple ways but just can't seem to figure it out. It is probably something really obvious.
Also note. I am using webkit gradient so test in chrome or safari. Thanks in advance for the help.