Changing javascript for jQuery for the first time on Struts 1.3 application

I am changing javascript in my jquery project. This is the first time I'm using jQuery and expecting me to make stupid mistakes. I placed a simple JQ alert function in a .js file that looks below.

$(document).ready(function(){
  $("#stt").change(function(){
    alert("hi");
  });
});

Thus, the goal is to issue a msg warning when the value of the td element with id = "stt" changes.

<tr id="stttr"> 
<td id="stt"> <html:text property="stt" size="20" maxlength="20"  style="height:12px; width: 180px;" /></td></tr>

and this is how im refers to jquery between jsp headers.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9/jquery.min.js"></script>
<script src="javascript/SearchPanelJQ.js"></script>
<script src="javascript/CalendarPopup.js"></script>

Calendarpop.js is an old javascript file that I do not want to replace (it works fine in all browsers). Now, when I visit this page in a browser with debug script enabled in IE, I get the following error.

HTML1201: localhost is a website you've added to Compatibility View. 
ReportingTemplate.jsp
SEC7115: :visited and :link styles can only differ by color. Some styles were not     applied to :visited. 
ReportingTemplate.jsp
SCRIPT5007: The value of the property '$' is null or undefined, not a Function object 
SearchPanelJQ.js, line 1 character 1

The last line tells me that something is wrong with the installation. Can you tell me that?

jsdt jquery plugin JQ v1.9. struts.

: 1) , JQ jsp. , .js. 2) http: , , document.ready JSP, .js . , .

+4
3

:

  • Chrome ( , )

  • > >

  • ( js, php , , )

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9/jquery.min.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9/jquery.min.js"></script>

, user2736012:

OP " ", , . , file://home/User/Desktop/foo.html, URL- file://ajax.googlapis..., , , . http, http://ajax.googleapis...

+1

, !

SCRIPT5007: The value of the property '$' is null or undefined, not a Function object 
SearchPanelJQ.js, line 1 character 1

- .

0

I found a problem. I refer to version JQ 1.9 because I read in the tutorial that he should automatically select the latest version in the 1.9 series. It works if I change it to 1.9.0 or 1.9.1. However, I still do not understand why 1.9 did not work. he had to choose the latest version of version 1.9.

But at least in doing this 1.9.1 / 0, it works from a .js file.

0
source

All Articles