Solved

detect <DIV> content changes

Posted on 2011-09-09
5
527 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
[X]
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
  • 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
A solution for Fortify Path Manipulation.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

635 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