Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 380
  • Last Modified:

"mailto" link in clickable div disappears when clicked.

Hi,

I have a "mailto" link in a clickable div. The link actually brings up a mail client but it makes the text in the div disappear.

I have an example here:

http://thelocalized.com/matt/contact.html

If you click on "apply for coverage" it brings up a mailto link. Clicking the link makes the text in the div disappear.

Thanks for the help!


 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script>
$(document).ready(function() { 
    $("div a").click(function() {
        $("#Coverage").removeClass("active")
        $(this).closest("div").addClass("active")
        var v = $(this).attr("id");
        $("#recipientId").val(v);
    });
});
</script>
<script>
	$(document).ready(function () {	
			    $("div a:not(.button)").click(function () {			
			var v = $(this).attr("id");
			$("#recipientId").val(v);
		
			var lhash = $(this).attr("href").substring(1);

			if(lhash==""){
				lhash="6"
			}
	
			$("a[href='#"+lhash+"']").closest("div").addClass("active");

			$('.label_copy').hide();
			$('#div'+lhash).show();

			if($("#recipientId").val()==6 || $(" #recipientId").val()==7 || $("#recipientId").val()==8) {
				$("#contactForm").show();
			}
			else {
				$("#contactForm").hide ();
			}
			$(".active").removeClass("active"); 
			if (recipID !== '') {
			$("#div" + recipID).show();
			$("#" + recipID).addClass("active");// do you mean that does'nt work
			$("#" + recipID).parent("div").addClass("active");// do you mean that does'nt work
		}
else {
   			$("#div6").show();
 			$("#6").addClass("active"); // please not 6 is not a valid id
			$("#6").parent("div").addClass("active"); // please not 6 is not a valid id
}
	
			$('.hide').click(function () {
				$('.label_copy').hide();
			});

		});
          $(".active").removeClass("active");
		url = window.location.search.substring(1);
		urlvars = url.split('&');
		var recipID = '';

		for (i = 0; i < urlvars.length; i++){  
			param = urlvars[i].split('=');  

			if (param[0] == "recipientId"){  
				$("#recipientId").val(param[1]) 
				recipID = param[1];
			}  
		}
		if (recipID !== '') {
			$("#div" + recipID).show();
			$("#" + recipID).addClass("active");
			$("#" + recipID).parent("div").addClass("active");
			
		}
	});
</script>


<style>

	
	#Coverage {
		background-image:url(images/rectangle-med-blue-with-shadow.png);
		background-repeat:no-repeat;
		margin: 0px 0px 0px 0px;
		padding: 10px 15px 10px 5px;
		width:170px;
		height:95px;	
		margin-left:20px;
		margin-top:15px;
		-webkit-border-radius: 8px;
		-moz-border-radius: 8px;
		border-radius: 8px;
		text-align:left;	
	}

	#Coverage:hover {
	background-image:url(images/rectangle-med-blue-with-shadow_H.png);
	cursor:pointer;
	}

	#Coverage a  {	
		font-family:Georgia, "Times New Roman", Times, serif;
		color:#FFFFFF;
		
		
	}
	
	#Coverage a.active {
		color:#000;
	}

	#Coverage.active {
		background-image:url(images/rectangle-dark-blue-with-shadow_B.png);
	}

	#Coverage a:hover  {
		color:#000;
	}	

	
	
	.label_copy {
		display:none;
	}
	#contactForm {
	width:610px;
	background-color:#F3F3F3;
	
	padding-left:20px;
	-webkit-border-radius: 8px;
		-moz-border-radius: 8px;
		border-radius: 8px;
	}
</style>

	
	
	<!--$if formSubmitted-->
			<title>The Doctors Company | Confirmation</title>
		<!--$else-->
			<title>The Doctors Company | <!--$tdcPageTitle--></title>
			<script language="JavaScript" type="text/javascript">
			function submitPage(){
				var SS= Spry.Widget.Form.validate(document.contactForm);
				document.forms["contactForm"].hdn_formaction.value="Submitted";
				document.forms["contactForm"].action="<!--$HttpCgiPath-->";
				if(SS==true){
				document.contactForm.submit();
				}
				//document.forms["contactForm"].submit()
				}
			</script>
			
			<style type="text/css">
			select	{
				font-size: 14px;
			}
			.truecaps {
				font-variant: small-caps;
				}
			fieldset	{
				margin-bottom:1em;
				padding-left:5px;
				border: 0px;
				border-top: 6px solid #5b6d82;
				border-bottom: 6px solid #5b6d82;
				background-color: #eceae9;
			}
			fieldset div {
				margin:0.5em 0;
			}
			legend	{
				display:none;
			}
			label	{
				line-height:20px;
				color:#565656;
			}
			.required	{
				color: #b41e1b;
			}
			input.text	{
				font-size: 11px;
    			/*height: 18px;*/
    			line-height: 11px;
    			margin-left: 0;
    			vertical-align: top;
    			width: 200px;
			}
			textarea {
				border: 1px solid #CCC; FONT-SIZE: 11px; MARGIN-LEFT: 0px; VERTICAL-ALIGN: top; WIDTH: 268px; LINE-HEIGHT: 11px; HEIGHT: 80px;
			}
			
			</style>


</head>

<body>

	<br/>
	
	<div id="Coverage">
	
		<span style="font-size:18px; font-family:Georgia, 'Times New Roman', Times, serif; color:#FFF;">Coverage</span><br/>

		<a id="3" href="#3" onClick="return false;" class="link">Get a Quote</a><br/>
		<a id="4" href="#4" onClick="return false;" class="link">Apply for Coverage</a><br/>
		<a id="5" href="#5" onClick="return false;" class="link">Find an Agent</a>
	
	</div>

	<div id="div1" class="label_copy">
<p>claims specialist</p>
	</div>

	<div id="div7" class="label_copy">
<p>Members</p>
	</div>

	<div id="div8" class="label_copy">
	<p>A patient safety/risk manager</p>
	</div>

	<div id="div3" class="label_copy">
		<p>Complete our simple form </p>
	</div>

	<div id="div4" class="label_copy">
			<a href="mailto:smfmetro@gmail.com"> Contact Us </a> Here is some text..It shouldn't disappear Here is some text..It shouldn't disappear Here is some text..It shouldn't disappearHere is some text..It shouldn't disappear Here is some text..It shouldn't disappearHere is some text..It shouldn't disappearHere is some text..It shouldn't disappearHere is some text..It shouldn't disappear Here is some text..It shouldn't disappear
	</div>

	<div id="div5" class="label_copy">
	<p>Apply for coverage</p>
	</div>

	
	<br/>
	                          

         <form id="contactForm" name="contactForm" method="post" encType="multipart/form-data" />
        <input type="hidden" value="WCM_SEND_FORM_EMAIL" name="IdcService" />
        <input type="hidden" value="WCM_EMAIL_CONTACT_TDC" name="tdcDynInclude" />
        <input type="hidden" value="<!--$ssServerRelativeSiteRoot-->ContactUs/Form/index.htm?formSubmitted=1" name="RedirectUrl">
        
        </form>

Open in new window

0
smfmetro10
Asked:
smfmetro10
  • 2
  • 2
1 Solution
 
GaryCommented:
In this function
$("div a:not(.button)").click(function () {...}

You hide everything with a class of .label_copy
0
 
smfmetro10Author Commented:
Ah- yes.
Is there a way to hide the div when the page loads but once it's open and you click the mailto link the text still stays....until another div is opened?
0
 
GaryCommented:
Change this
$("div a:not(.button)").click(function () {      

to
$("#Coverage a:not(.button)").click(function () {      
0
 
smfmetro10Author Commented:
Thank You!
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now