Append 'Click to Exit' to H4 Element

Hello all,

For some reason, this line of code will not execute:


 $("#successfulsubmit h4").append('Click to Exit');

It is within this block now, but I have tried it in other places…


			setTimeout(function(){
			  $("#successfulsubmit h4").append('Click to Exit');	
		          $("#blackoverlay, #successfulsubmit").click(function(e){
			     $("#blackoverlay, #successfulsubmit").remove();
		           });

This is the associated HTML:


    <div id="successfulsubmit">
    	<h3>&nbsp;</h3>
    	<p>&nbsp;</p>
        <h4>&nbsp;</h4>
    </div>

It’s on this page (emailbox.js).

Is it simple to know why that append statement won’t work when there are other .append() statements that work fine?

Thanks all!

Hi Tyler,

If I look at the source of your page, the <div> with the id of “successfulsubmit” looks like this:

<div id="successfulsubmit">
  <h3>&nbsp;</h3>
  <p>&nbsp;</p>
</div>

Try adding the <h4> tag to your HTML and see if that helps.

Yes, it is simple to know why. It must be because the selection doesn’t exist.

#successfulsubmit exists, but there is no h4 element inside there.

:blush:

Oops, I thought I had uploaded those new files.