javascript - Change input element with jQuery ID selection and css -
i'm trying change background color of input element function using jquery.css syntax. in function, called @ ready
event, execute:
$("#inputid_1").css("background-color", "red");
but color not become red.
i can use:
<input type='text' id=' inputid_1 ' style="background-color:blue" />
in html change color. or:
$("input").css("background-color", "gray");
in javascript. ability use jquery-id selection doesn't seem work!
you can find jsfiddle here.
the gaps in html elements id's make difference - remove them out , work wish.
so, change:
<input type='text' id=' inputid_1 ' style="background-color:blue" /> <input type='text' id=' inputid_2 ' />
to
<input type='text' id='inputid_1' style="background-color:blue" /> <input type='text' id='inputid_2' />
here's working jsfiddle.