0

Here, the scenario is i want to make a javascript function call inside a div after specific time ..But How do I implement it using javascript/ajax?

<div class="container" function()>
</div>
User57
  • 2,453
  • 14
  • 36
  • 72
  • 1
    See `setTimeout` in JavaScript – Sandeep Nayak Aug 31 '16 at 06:01
  • 1
    Div's do not have an onload event either – mplungjan Aug 31 '16 at 06:03
  • divs do not have an `onload` attribute; what are you trying to do? – Jacob Aug 31 '16 at 06:03
  • I see your ajax tag: Please clarify: Are you asking how to trigger a function call after an ajax response has been received? Or something else? – markE Aug 31 '16 at 06:09
  • Possible duplicate of [How to add onload event to a div element?](http://stackoverflow.com/questions/4057236/how-to-add-onload-event-to-a-div-element) – nikjohn Aug 31 '16 at 06:10
  • Why it's important to have a script _in_ a div? The placing of a script usually doesn't matter. – Teemu Aug 31 '16 at 06:14
  • Actually I want to reload the div after specific time , so when it reload it called a ajax function which will load the update data..so it's my problem in details..So if you have a better solution, you can suggest .. – User57 Aug 31 '16 at 06:43

1 Answers1

0

Divs don't have an onLoad handler. One thing you can do is to quickly and dirtily put a script tag under your div like so:

<div class="container">
</div>
<script>
 setTimeout(function() {
    //Do what you want to do
}, 5000)
</script>
nikjohn
  • 20,026
  • 14
  • 50
  • 86