When a button is clicked it needs to look before its ocurance and find a specific span tag. Unfortunately it is either not finding the tag or not changing it's contents.
This is the code that doesn't work.
$(this).prev("span[id*=CommentText]").hide();
I can set the colour during the load event but when the link is clicked it won't make any changes.
This works but only during the load phase:
$("span[id*=CommentText]").css("background-Color", "red");
EDIT:
<html>
<head>
<script src="../Scripts/jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
<script src="../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="../Scripts/jquery.color.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("textarea[id*=Comments]").hide().css("background-Color", "white");
$("span[id*=CommentText]").css("background-Color", "red");
$("a[id*=CommentLink]").click(LoadComments).css("background-Color", "white");
});
function LoadComments() {
$(this).prev("textarea[id*=Comments]").animate({ backgroundColor: 'yellow' }, 500).show().focus();
$(this).prev("span[id*=CommentText]").css("background-Color", "white");
$(this).fadeOut();
}
</script>
</head>
<body>
<span id="Q37CommentText">comments here</span>
<textarea name="Q37Comments" rows="1" cols="50" id="Q37Comments">comments here</textarea>
<a id="Q37CommentLink">Add/Edit Comment</a>
<span id="Q40CommentText">Comment 2</span>
<textarea name="Q40Comments" rows="1" cols="50" id="Q40Comments">Comment 2</textarea>
<a id="Q40CommentLink">Add/Edit Comment</a>
</body>
</html>