Time remaining:

How do you change an elements class in JavaScript?

Computer Science
account_circle Unassigned
schedule 0 Hours
account_balance_wallet $5

I have an existing script. where i have it marked, i would also like to remove an existing class. How would i do that? i have never even attempted to mess with JavaScript until today.

$(function () {

var msie6 = $.browser == 'msie' && $.browser.version < 7;

if (!msie6) {
var top = $('#comment').offset().top - parseFloat($('#comment').css('margin-top… 0));
$(window).scroll(function (event) {
// what the y position of the scroll is
var y = $(this).scrollTop();

// whether that's below the form
if (y >= top) {
// if so, ad the fixed class
$('#comment').addClass('fixed'); RIGHT HERE!!!!
} else {
// otherwise remove it

Nov 30th, -0001
whats the problem in it. its working fine for me.
the line $('#comment').removeClass('fixed');
removes the class.
what problem are u facing in it?
Jul 15th, 2013

Did you know? You can earn $20 for every friend you invite to Studypool!
Click here to
Refer a Friend
Nov 30th, -0001
Nov 30th, -0001
Mar 21st, 2018
Mark as Final Answer
Unmark as Final Answer
Final Answer

Secure Information

Content will be erased after question is completed.

Final Answer