Asp.net webforms + jquery = can't click button

I wanted to include jquery in the masterpage, but as soon as I did this - my login page stopped working ... in the chrome console I get:

uncaught TypeError: Cannot read property 'onsubmit' of null 

from the stack I see that he is here:

 Sys.WebForms.PageRequestManager._initialize('ctl00$ScriptManager1', document.getElementById('aspnetForm')); 

in firefox:

 this._form is null this._onsubmit = this._form.onsubmit; 

and is this error located in ScriptResource.axd? = ...

and this leads to the fact that I can’t just click the "Login" button - it does nothing ... on the other hand - everything works in Opera ... even better - if I delete:

 <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.5.min.js" type="text/javascript" /> 

then everything works fine (tried other versions of jquery) ... now it’s best that other pages, which also have buttons and events, work ... I even changed the login page so as not to use the login system ... and it still doesn't work ... I'm really confused right now ...

+4
source share
1 answer

My colleague found a solution by accident ... if you change:

 <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.5.min.js" type="text/javascript" /> 

to

 <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.5.min.js" type="text/javascript"></script> 

it magically starts working ... now ... it should be xhtml ... can someone explain to me WHY there is a difference here ?!

+11
source

Source: https://habr.com/ru/post/1337956/


All Articles