Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

detect <DIV> content changes

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

Not sure which OpenStack Certification to get?

So you’ve realized you might want to get certified in OpenStack, but you’re not sure what the benefits might be or even which one you should take. You know there are several certification courses you can choose from, but how do you know which one is right for you?

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
A solution for Fortify Path Manipulation.
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

664 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