Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

detect <DIV> content changes

Posted on 2011-09-09
5
Medium Priority
?
537 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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…
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

971 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