c# - Change background color upon textbox value changed -
I want to change the background color of my webpage when choosing a color from an ASPColorPicker and color code textbox I have this jQuery code
& lt; Script type = "text / javascript" & gt; Function Change Caller () {$ ('# Page'). CSS ('background', $ ("#colickertextbox") .val ()); } $ ("#color tickertextbox"). Change (change color); & Lt; / Script & gt;
and text box
& lt; Asp: text box id = "color picture textbox" onchange = "changecolor" runat = "server" & gt; & Lt; / ASP: text box & gt; & Lt; Asp: ColorPickerExtender TargetControlID = "Color Picture Textbox" ID = "Color" Runat = "Server" & gt; & Lt; / ASP: ColorPickerExtender & gt; I have this ID in
and CSS
#page {width: 990px; Margin: 0 auto; Padding: 20px 5px; Background: #FF99FF; }
Add JavaScript Function:
Function selected color changed (Sender) {$ ("# page"). Css ({backgroundColor: "#" + sender_gate_selected collar ()}); }
and OnClientColorSelectionChanged
parameter with this name of your ColorPickerExtender
:
& lt ; Asp: ColorPickerExtender TargetControlID = "ColorPickerTextBox" id = "Color" runat = "server" on-client caller switch = "selected caller switching" & gt; & Lt; / ASP: ColorPickerExtender & gt;
Comments
Post a Comment