Jump to content

chronister

Members
  • Posts

    1,438
  • Joined

  • Last visited

Everything posted by chronister

  1. Hi Folks... Hope everyone is doing well today! I have researched this and cannot determine how to do this. Any help here would be appreciated. I have a div area that shows a set of images pulled from a directory. I have a dblClick event working on a label around them for the first load that changes the src of another element to the src of the clicked image (edit in place system for website) and goes away so the page can be saved with the new image. When I upload a new image via ajax and then refresh this area to display the newly uploaded file, my dblClick event no longer works. I remember seeing this has to do with explicitly binding the click event to the dynamically created elements. I cannot find any information on how to bind a dblClick event to my img elements after I refresh the section. Here is the code I am working with. This is all inside a document ready block just to clarify. This is the dblClick event that gets attached to the label $('.newimageContainer label').on("dblclick",function(e){ // Get the src of the img below the label that was clicked imgSrc = $(this).children("img").attr('src') // Set the src of the prior selected page image to the new src $('.changing').attr("src", imgSrc); // close modal modal.close(); }); Here is the code that does the replacing of data. It is the complete callback inside an ajax function. complete: function(){ // STOP LOADING SPINNER AND DISPLAY MESSAGE $('.msgArea').html('<strong>SUCCESS: File Uploaded</strong>'); // Clear the html inside the image picker $('#imagePickerWrapper').html(''); // reload and load the new set of data into the image picker area $('#imagePickerWrapper').load( "/lib/php/updatePage.php .images" ); } It is after this .load method gets called that my dblClick stops working. If anyone can help, I would appreciate it very much... Here is the HTML block for the image picker area (with the php function call) <div id="imagePickerWrapper"> <span class="images"><?php echo displayUserImages(); ?> </span></div> Thanks, nate
  2. I think I got it.. but what say ye javascript gurus.... Jessica, it was not opening the found / lost main section when the 1st level ul li item was clicked. But the 2nd level li items would show those individual sections. I have changed the jquery and it does work as intended, but I think it could be better. <script> $(function(){ $('#lost_cats, #found_cats, #lost_dogs, #found_dogs').hide(); $("#lost-and-found a").click(function(event) { var href = $(this).attr('href'); $('#lost_cats, #found_cats, #lost_dogs, #found_dogs').hide(); $(href).show(); $(href).children().show(); event.preventDefault(); }); }); </script> Not I am not using chrome dev tools or firebug (though I do have it installed.. I think) Is the code here ok or do you have a suggestion to make it better? I think it is probably clumsy.
  3. Hello all, How is everybody doing today?? I am trying to get an unorderd list as trigger to toggle / expand some div's and I am struggling on this. Can someone point me in the right direction? <div id="lost-and-found"> <ul> <li><span><a href="#lost">Lost Animals</a></span> <ul> <li><a href="#lost_cats">Cats</a></li> <li><a href="#lost_dogs">Dogs</a></li> </ul> </li> <li><span><a href="#found">Found Animals</a></span> <ul> <li><a href="#found_cats">Cats</a></li> <li><a href="#found_dogs">Dogs</a></li> </ul> </li> </ul> <div class="clear"> </div> </div> <div id="found"> <div id="found_cats"> <h2>Found Cats</h2> <?php display_lf($found['cat']); ?> </div> <div id="found_dogs"> <h2>Found Dogs</h2> <?php display_lf($found['dog']); ?> </div> </div> <div id="lost"> <div id="lost_cats"> <h2>Lost Cats</h2> <?php display_lf($lost['cat']); ?> </div> <div id="lost_dogs"> <h2>Lost Dogs</h2> <?php display_lf($lost['dog']); ?> </div> </div> <script> $(function(){ $('#lost_cats, #found_cats, #lost_dogs, #found_dogs').hide(); $("#lost-and-found a").click(function(event) { var href = $(this).attr('href'); $('#lost_cats, #found_cats, #lost_dogs, #found_dogs').hide(); $(href).show(); $(this).parent("div").show(); event.preventDefault(); }); }); </script> The ul is 2 buttons (Lost / Found) with Cat and dog under each. I have a div with id of lost and one with found. Inside each, there lost cat, lost dog and found cat, found dog respectively. I am trying to hide all sections initally with jquery and then open the lost / found section or the subsections of lost -> dog, lost -> cat, found ->dog, found -> cat. Any tips / pointers will be appreciated.
  4. Yeah, it appears to be just normal form field processing. You can use the whole mask thing, but I find it annoying when the page dictates what can be entered via javascript. I would just make it so you can accept any time format and then make it the format you want. I disagree with this. At first it makes it easy as the rules are not so tight as to how it is formatted... but if you need to do any kind of query past SELECT this FROM that you may have trouble. When I started, I would store dates and times in a varchar field and it made it easy, until I needed to select dates and times between 2 points, or dates where it falls on a particular day.. Store dates and time as the proper format, it will become easier as time goes.
  5. In the past I have recommended 1and1. Although I have read numerous negative reviews about them I had not had any trouble with them. That is until recently. Their FTP server has been down 3 times in the last 2 weeks. Not for any long periods of time, but when I need to modify a file and re-upload it then I need to do it now without issues. So I formally withdraw my support for 1and1. I will be checking into some of the hosts you folks have provided here. Nate
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.