Solved

detect <DIV> content changes

Posted on 2011-09-09
5
512 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now