0
<div id="right-side-panel">
        <span>UserName:<br />
        <input id="txtUserName" type="text" />
        </span>
        <br />
        <span>Password:<br />
        <input id="txtPassword" type="password" />
        </span>
        <br />        
        <input id="btnLogin" type="button" value="Login" />
        </div>

How can I reach this txtUserName from css file? I want to change textBox's things.

#right-side-panel .. then?

Thanks in advance

3
  • just #txtUserName ? Edit: come on guys, you've got to be kidding... all you need is the #txtUserName! Commented Nov 9, 2011 at 14:37
  • 2
    I thought this was a trick-question when I first read it Commented Nov 9, 2011 at 14:39
  • It would be nice to have a -1 on the first comment Commented Nov 9, 2011 at 17:21

3 Answers 3

1

The W3C defines IDs as "a unique identifiers to an element", so you just need #txtUserName in order to match that <input>.

Sign up to request clarification or add additional context in comments.

Comments

0

for example: in css #txtUserName { color:black; }

in jQuery $('#txtUserName').css('color', 'black');

Comments

0

why can't you just do: input#txtUserName?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.