Build with IDX Broker Forums General Discussion How to use JS on saved properties after ajax

Viewing 3 reply threads
  • Author
    Posts
    • idxbroker
      Keymaster
      Post count: 179

      SO loading after ajax can be done a few ways, you can set a timeout like:

      setTimeout(function(){ //do some JS stuff }, 3000);

      Or you can listen for an event. Like the appearance of an element. Example: http://stackoverflow.com/questions/6115026/how-to-tell-javascript-to-execute-a-function-after-an-element-has-been-loaded

      function myFunc() {
      if (document.getElementById('myElement')) {
      // do stuff
      } else {
      setTimeout(myFunc, 15);
      }
      }

      1 rating, 1 vote1 rating, 1 vote (+1 rating, 1 votes, rated)
      You need to be a registered member to rate this post.
      Loading...
    • Tony Eppright
      Participant
      Post count: 22

      Thanks Antonio. Tried this (and a bunch of others) with no luck. I thought I had it but realized once I added more than one property, it was appending the price for all properties to each listing. So if I had 6 listings, each one showed all 6 prices.

      I tried using a loop with the setTimeout function, but gave me an infinite loop.

      I’ve been trying to work with some form of this:


      $(".IDX-myAccountLink").click(function(){

      setTimeout(function() {

      if (document.getElementsByClassName('IDX-savedProperty')) {

      alert( 'Button Clicked' );

      $(".IDX-savedPropListingPrice").appendTo(".IDX-savedPropertyInfo");

      }

      }, 1000);

      });

      Any other thoughts? Thanks again for taking a look.

      1 rating, 1 vote1 rating, 1 vote (+1 rating, 1 votes, rated)
      You need to be a registered member to rate this post.
      Loading...
    • Tony Eppright
      Participant
      Post count: 22

      I ended up using CSS to manipulate the elements. Would still like to know how I can accomplish this if anyone has any thoughts, but had to find a working solution so I gave up on the JS version.

      1 rating, 1 vote1 rating, 1 vote (+1 rating, 1 votes, rated)
      You need to be a registered member to rate this post.
      Loading...
Viewing 3 reply threads
  • You must be logged in to reply to this topic.