- $(document).ready(function(){
- $("body").keyup(function()
- {
- var username = $("#user").val();
- $("a").filter('a[href$='"'+username'"]').css("background-color", "#ff0000");
- });
- });
I am trying to filter the form value to change some links color and background but this is incorrect
$("a").filter('a[href$='"'+username'"]').css("background-color", "#ff0000");
This is an example of the HTML
- <body>
- <div class="main">
- <p>
- Lorem Ipsum is simply dummy text of the printing and typesetting industry.
- <a href="u=3153">user1</a>, <a href="u=31532">user2</a>, <a href="u=231532">user3</a>, <a href="u=11111">user4</a>, <a href="u=22222">user5</a>.
- </p>
- </div>
- <div id="buttons">
- <form method="post" action="">
- Username:<br />
- <input type="text" value="" class="userform" id="user" maxlength="15"/>
- <br />
- <input type="submit" value=" Submit " class="submit"/>
- </div>
- </body>