Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery show() dynamically built element
    primarykey
    data
    text
    <p>I have a empty hidden div that will include information from an AJAX call. It works without the jquery show command, but I wanted to add the smooth opening of the div with jquery instead of the abrupt style="display: ''" approach. The command to open the div is on line 7 of the function. I took it out to get the jquery approach to work lower down in the function.</p> <p>The code that I have that works is here:</p> <pre><code>function showImage(IDS, selectedID){ var adType = new Array(); adType = IDS.split("_"); var thumbs = new Array(); var adID = thumbs[0]; var picImage = document.getElementById(adType[0] + '_' + thumbs[0]); //picImage.style.display = ''; //picImage.className = "picDetail"; removeChildren(picImage); var picThumbs = document.createElement('div'); arLen = thumbs.length; //alert(arLen); if(arLen &gt; 2){ for ( var i=1, len=arLen; i&lt;len; ++i ){ //alert(thumbs[i]); var thumbNail = document.createElement('img'); thumbNail.src = "../images/listings/" + adID + "_" + thumbs[i] + "_sm.jpg"; thumbNail.className = "thumbNails"; thumbNail.id = adID + '_' + thumbs[i]; picThumbs.appendChild(thumbNail); picImage.appendChild(picThumbs); addHandler(adID, thumbs[i], 1); } } var previewImageContainer = document.createElement('div'); var previewImage = document.createElement('img'); previewImage.id = 'full_' + adID; previewImage.src = "../images/listings/" + adID + "_" + "1_.jpg"; previewImage.className = 'thumbNails'; previewImageContainer.style.width = "700px"; previewImageContainer.style.textAlign = 'center'; previewImageContainer.appendChild(previewImage); picImage.appendChild(previewImageContainer); var closeButton = document.createElement('img') closeButton.src = '../images/close_pix.png'; closeButton.id = 'close_' + adType[0] + '_' + adID; picImage.appendChild(closeButton); addHandler(adID, 'close_' + adType[0], 2); //"butShowImage_" + thumbs[0]) is the name of the buttom that corresponds //to the particular trigger and (adType[0] + '_' + thumbs[0]) is the name of the div I want //to open. $("butShowImage_" + thumbs[0]).live('click', function () { $("#" + adType[0] + '_' + thumbs[0]).show('blind', {}, '200'); }); } </code></pre> <p>Am I using the wrong approach here? Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload