Skip to content

Tag: javascript

How to add and remove classes in Javascript without jQuery

I’m looking for a fast and secure way to add and remove classes from an html element without jQuery. It also should be working in early IE (IE8 and up). Answer The following 3 functions work in browsers which don’t support classList: https://jaketrent.com/post/addremove-classes-raw-javascript/

call javascript function onchange event of dropdown list

I want to invoke javascript function when value in the dropdown list changes. I dont want to hardcode dropdown list id . Hence not using document.getElementById My Code: This is giving error ReferenceError: jsFunction is not defined Fiddle : http://jsfiddle.net/6uyz4b8x/1/ Answer Your code is working just fin…

JavaScript submit form excluding fields

I have a simple html form: And I need to submit it with JavaScript, but I want to exclude the dontSubmitThisField field from the request. Is there a way of doing that without Ajax? Answer Just disable the field. Either do it via HTML if the field cannot be updated by the user: http://www.w3schools.com/tags/at…