Jump to content

[SOLVED] onclick show div


newbtophp

Recommended Posts

Can someone help me please?

 

I have a form which on submit it shows a div, the problem is it shows the div for less then a second then returns back to its normal state and hides.

 

Heres the javascript:

 

<script language="javascript"> 
function toggle() {
var ele = document.getElementById("toggleText");
var text = document.getElementById("displayText");
if(ele.style.display == "block") {
    		ele.style.display = "none";
	text.innerHTML = "show";
  	}
else {
	ele.style.display = "block";
	text.innerHTML = "hide";
}
} 
</script>

 

Heres the snippet from the form:

 

<input name="submit" type="submit" value="Submit" onclick="javascript:toggle();"><BR>

 

Heres the div (im trying to show when the form is submitted):

 

<div id="toggleText" style="display: none"><iframe src="yell.php" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe></div>

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/166451-solved-onclick-show-div/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.