javascript - JQuery adding and then removing same image -


i using jquery show green check-mark , message on successful submission. image , message show correctly. want remove image , message using jquery's hide function. have used before no problem when html on page already. time not working , i'm wondering if since html being added jquery , removed. i'm not sure if element child of element or not, may problem. insight issue huge help, thanks.

jquery code:

$("<span id='checkmark'><img height='45' width='45' src='./img/checkmark_green.jpg'/>&nbsp;<span style='color: #33cc33; font-size: 14pt'>word added dictionary.</span><br/></br></span>").prependto("#div_dict");  //i tried '#div_dict > #checkmark'              $('#checkmark').click(function(){     $(this).hide('slow'); }); 

html/php:

echo('<div id="div_dict">');         echo('<big id="add"><b>add word or phrase dictionaries</b></big><br/>');         echo('<form id="form_dict" name="form_dict">');         echo('<input id="entry" name="entry" size="30"/><br/>');         echo('<input type="radio" id="sent" name="sent" value="positive"/>positive&nbsp;&nbsp;<input type="radio" id="sent" name="sent" value="negative"/>negative<br/><br/>');         echo('<input id="but_dict" type="button" value="submit" onclick="addtodict();"/>');         echo('</form>');         echo('</div>'); 

your code works me if want click text remove it. can remove click function hide on it's own if you're after.

$("<span id='checkmark'><img height='45' width='45' src='./img/checkmark_green.jpg'/>&nbsp;<span style='color: #33cc33; font-size: 14pt'>word added dictionary.</span><br/></br></span>").prependto("#div_dict");  $('#checkmark').delay(2000).hide('slow'); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -