Web Analytics Made Easy -
StatCounter JQuery question - CodingForum

Announcement

Collapse
No announcement yet.

JQuery question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • JQuery question

    Hi all, does any of you have an idea why the first of the two above examples works (in selecting the input element) while the second does not? is my following suspicion correct?

    - once an html input-element get's a name attribute it can no longer be addressed with the generic $("input") selector?


    Greets

    HTML-code:

    Code:
    <!DOCTYPE html>
    <html>
        <head>
        	<title>To Do</title>
            <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
            <script type="text/javascript" src="script.js"></script>
    	</head>
    	<body>
    		<h2>To Do</h2>
    		<form name="checkListForm">
    			<input type="text" name="checkListItem"/>
    		</form>
    		<div id="button">Add!</div>
    		<br/>
    		<div class="list"></div>
    	</body>
    </html>
    JQuery-code:

    Code:
    $(document).ready (function(){
        $("input[name=checkListItem]").focus(function(){
            $(this).css('outline-color','#FF0000');
        })
            
        ;})
    Code:
     
        $(document).ready(function(){
        $("input").focus(function(){
            $("input").css("outline-color","##FF0000"); 
            });
        });
    I have been in love with my computer for about a year. Her patience with me is endless, for often times I have scolded her, accusing her of not working. But never, not once, has she lied to me or been unfaithful...

  • #2
    No, the problem is a simple syntax error:

    Code:
    $("input").css("outline-color","[COLOR="#FF0000"]##[/COLOR]FF0000");
    Stop solving problems you don’t yet have!

    Comment


    • #3
      Allright thnx a lot Stephan!
      I have been in love with my computer for about a year. Her patience with me is endless, for often times I have scolded her, accusing her of not working. But never, not once, has she lied to me or been unfaithful...

      Comment

      Working...
      X