I have an input that is supposed to add a class of clicked to another element with an id of #zip when clicked. Here is the code:
$('#billing_zip').click(function () {
$('#zip').addClass('clicked');
});
#zip {
color: #444;
font-style: italic;
position: absolute;
top: 8px;
left: 35px
}
.clicked {
display: none;
}
<div class="chkField">
<label for="billing_zip">Zip</label>
<input type="text" onchange="clearContent(this);check_address('billing');" class="txtBoxStyle hasPlaceholder" tabindex="10" size="10" value="" id="billing_zip" maxlength="15" name="billing_zip">
<!--START: req_billing_zip-->
<img width="12" height="12" alt="" src="assets/templates/common/images/error2.gif">
<!--END: req_billing_zip-->
<div class="clear"></div>
<div id="zip">zip</div>
</div>
I don't know why the above jQuery is not working.
clickedclass is getting applied. jsfiddle.net/8L5qdeu7$(document).ready(function(){//Your Jquery Code//});