May 4, 201214 yr Quick question. With this: http://michaelgunner.co.uk/insta/ I'm using Ajax to make an API request. The thing is, because it's Ajax, the resulting code shows up in the DOM but not in the source, of course. But what this seems to mean is no other Javascript/jQuery works with it. For example (purely for testing): $(document).ready(function () { $(".sort").hover(function(){ $(".instagram-placeholder").css("opacity","0"); }); }); Nothing happens to "instagram-placeholder". I assumed using document ready would work, but it appears not. Any ideas? I can't imagine that you just can't do this? Edit: A little research seems to hint at firing the event after the Ajax has loaded. This seems to work: $(function() { $.ajax({ type: "GET", dataType: "jsonp", cache: false, url: "https://api.instagram.com/v1/users/*************604", success: function(data) { for (var i = 0; i < 6; i++) { $(".instagram").append("<li data-tags='"+ data.data[i].filter +"' class='instagram-placeholder'><a href='#" + data.data[i].id +"'><img class='instagram-image " + data.data[i].filter +"' src='" + data.data[i].images.thumbnail.url +"' /></a></li><div class='overlay' id='" + data.data[i].id +"'><img class='instagram-image' src='" + data.data[i].images.standard_resolution.url +"' /><a href='#page' class='close'>close</a><div class='controls'><h2>" + data.data[i].caption.text +"</h2></div></div>"); $("#filter").append("<li class='sort'><a id='"+ data.data[i].filter +"' href='#"+ data.data[i].filter +"'>"+ data.data[i].filter +"</a></li>"); } $(".sort").hover(function(){ $(".instagram-placeholder").append("<p>h</p>"); }); } }); }); Correctimundo? Edited May 4, 201214 yr by brightonmike
May 4, 201214 yr Author Ok - that sort of works, but I can only manipulate non-Ajax IDs/Classes. IF I try to manipulate one loaded by the Ajax, no fun.
May 11, 201214 yr JavaScript is very important for an application,it is a client side scripting language.JavaScript is used for client side validation in an application.
Create an account or sign in to comment