JavaScript Codes - Enzow.org
Plain JavaScript codes
Remove class elements
// For removing class elements in Javascript
function removeElementsByClass(className){
// Get all elements by the classname
var elements = document.getElementsByClassName(className);
// Check wether if there are more than 0 (to delete)
while(elements.length > 0){
// Remove the element by using the parent to get the classelemen
elements[0].parentNode.removeChild(elements[0]);
}
}
On hit enter
// While our focus is on the coupon field, check wether a key of the keyboard has been released
$('#couponcode').keyup(function (event) {
// If it really is an enter
if (event.keyCode == 13) {
// Run the check
alert('You just hit the enterbutton, didn`t you?!');
}
});