TypeError: Cannot read property “removeAttribute” of null


I'm trying to alert "hello" as soon as a button is clicked. I get the error above on my browser, and as seen in the html below, I put the script link below the button tag so I don't know what causes the error. Any help is appreciated.


<pre class="snippet-code-js lang-js prettyprint-override">$(function(){ $("#passform").click(function(){ alert("hello"); console.log("hello"); }); });


<pre class="snippet-code-html lang-html prettyprint-override"><!DOCTYPE html> <html> <head> <link href="public/stylesheets/style.css" rel="stylesheets" /> </head> <body> <button type="submit" id="passform"></button> <script type="scripi/javascript" src="C:/users/owner/desktop/steelVault/public/javascripts/receiver.js"></script> <script type="scripi/javascript" src="C:/users/owner/desktop/steelVault/public/javascripts/jquery/jquery-2.2.4.min.js"></script> </body> </html>


Your receiver.js file clearly references jQuery and thus depends on it. As such, you'll need to ensure that you reference jQuery prior to referencing your other files that depend on it :

<script type="script/javascript" src="C:/users/owner/desktop/steelVault/public/javascripts/jquery/jquery-2.2.4.min.js"></script> <script type="script/javascript" src="C:/users/owner/desktop/steelVault/public/javascripts/receiver.js"></script>

Besides this, I don't see any code that would explicitly reference the removeAttribute() function, so there is some code missing from the example or an issue with some of the scripts not loading properly.


<pre class="snippet-code-html lang-html prettyprint-override"><!DOCTYPE html> <html> <head> <!-- Omitted --> </head> <body> <button type="submit" id="passform"></button> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script> $(function() { $("#passform").click(function() { alert('hello'); console.log('hello'); }); }); </script> </body> </html>


Are you running this on chrome? It could be related to AdBlock. Try changing your browser to FireFox and see if you're getting the same error.


  • node-sass-middleware not rendering using express
  • Accessing CSS custom variable with Javascript
  • Magento - FishPig Integration - Not getting correct template for /blog
  • Overriding window.location on Webbrowser Control
  • Declaration of does not work with Ionic's ion-nav-view in IBM MobileFirst
  • How to add regEx in angular filter
  • Is looping through all style sheets and classes a good idea in JavaScript?
  • Why isn't obj.style.left = “200px”; working in this code?
  • Bootstrap (v3.3.4) glyphicons not displayed in IE when refresh page (F5)
  • Tell Git to stop prompting me for conflicts when none really exist?
  • Simulate click Geckofx vb,net
  • Adjust width of select element according to selected option's width
  • jQuery ready not fired after rails link_to is clicked
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • How do I alternate colors in Flat List (React Native)
  • Listbox within Listbox and scrolling trouble in Windows Phone 7 Silverlight
  • Jquery UI tool tip close icon
  • Display issues when we change from one jquery mobile page to another in firefox
  • HTML download movie download link
  • Updating server-side rendering client-side
  • Modifying destination and filename of gulp-svg-sprite
  • jquery mobile loadPage not working
  • Unanticipated behavior
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • How to set the response of a form post action to a iframe source?
  • JTable with a ScrollPane misbehaving
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Change div Background jquery
  • unknown Exception android
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • failed to connect to specific WiFi in android programmatically
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal
  • How can I use threading to 'tick' a timer to be accessed by other threads?