Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

detect <DIV> content changes

Posted on 2011-09-09
5
520 Views
Last Modified: 2012-05-12
Is it possible to detect <DIV> content changes by using jquery ?

my browser: IE 7
0
Comment
Question by:cofactor
  • 2
  • 2
5 Comments
 

Author Comment

by:cofactor
ID: 36508740
I need a watch on a <DIV> . If the content changes I want to do something.
0
 
LVL 8

Expert Comment

by:vsudip
ID: 36509355
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 36509420
Usually if the content changes is because you do something to it, so you should be able to check this event and compare if the result is different that the current value.

However the value could be changing by a server response, so you cannot check that on client code. Then I supose you can do two different things:

1) Add an interval function on your client code that checks the div content and compares it to the value it has on page load. When they are different the function launch an event call and you add a listener for this event.

2) Use inside your div an element with onChange event. You can use a <textarea> or an input type text, use css to blend it's styles like the normal div and make your server code to change it's value instead of the div code. Then you'll be able to detect that event.
0
 

Author Comment

by:cofactor
ID: 36510137
(1) polling will hang my browser ...also there is a waiting time.

(2)
>>>make your server code

Not possible. There are many Action class  which send their  JSP's to sit on this  common <DIV> . How many you'll change ?  not  smart work.
0
 
LVL 19

Accepted Solution

by:
Bardobrave earned 500 total points
ID: 36511029
Then I fear you cannot detect the changing of the div if it comes from a server action, as javascript cannot detect events on the server and server side code cannot fire events on client machine.
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
session migration servlets 2 42
CSV file parsing thru Java 13 34
Glassfish admin console not working 1 32
java imports not found 4 16
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn how to implement Singleton Design Pattern in Java.

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question