Joppo
Joppo

Reputation: 729

jquery removeClass does not work

pls consider the following simplified code which is supposed to SHOW the div element, but it doesn't. I checked this site and the jquery site (http://api.jquery.com/removeClass/) but cant figure out why removeClass is not working in my code???

Pls your help...

code:

<head>
<style>
.hideElement {display:none;}
</style>


</head>
<script type="text/javascript" src="/js/jquery-1.10.1.min.js"></script>        

<body>
<h2>Products </h2>

<form id="myForm" name="myForm" action="" method="post" autocomplete="on">

    <div class="hideElement" id="product1"> Product X </div>

<input type="submit" name="submitForm" value="Submit Form">
</form>

<script type="text/javascript">

$(document).ready(function(){

    $("#product1").removeClass('hideElement');

}
)

</script>

Upvotes: 1

Views: 853

Answers (2)

MaxPRafferty
MaxPRafferty

Reputation: 4977

Your code works as is: http://jsfiddle.net/MaxPRafferty/KdFYY/

$(document).ready(function(){

    $("#product1").removeClass('hideElement');

}
)

Is JQuery loading properly? Check your path.

Upvotes: 1

Suresh Atta
Suresh Atta

Reputation: 121998

The only possibility here for the issue of your jquery file path

<script type="text/javascript" src="/js/jquery-1.10.1.min.js"></script>  

To test it ,try with

<script type="text/javascript" 
                     src="http://code.jquery.com/jquery-latest.min.js" ></script>

otherwise everything working fine in fiddle.

Upvotes: 1

Related Questions