Change css of first div after live click

morphyzz

New Member
I want to be able to change the css of a div after I have clicked span.submit-comment.How would I go about to change the css of that div.I tried putting the following in the success part of the script:\[code\]$('div.news-comment:first').css("background-color", "#000");\[/code\]But the div just flashes black (as I click) because it's inside the click function. I want the css to persist untill I refresh the page.Any ideas?\[code\]// post news comment $('span.submit-comment').live('click', function() { var commentname = $('input#commentname').val(); var commentcontent = $('textarea#commentcontent').val(); var newsid = $('span.view-comments').attr('id'); var datastring = 'commentname=' + commentname + '&commentcontent=' + commentcontent + '&newsid=' + newsid; $.ajax({ type: "POST", url: "ajax/post_news_comment.php", data: datastring, success: function(){ $('div#news-comments').load('ajax/get_news_comments.php?news_id=' + newsid); } }); });\[/code\]
 
Top