Reputation: 39
i am trying to show or hide the textbox or form of html while clicking on link button which is generated via echo php statement..
but it does not work..
<script>
function onHide()
{
alert("hide");
document.getElementById("txt").style.display = "block";
$("#txt").show();
}
</script>
<body>
<input type="text" name="txt" id="txt" style="display: none;">
<input id="btn" value="hide/show" type="button" "value="hide/show" onclick="onHide()" /><!-- here onHide works -->
<?php
echo "<br/><a onclick='onHide()' id=".$row['id'].">Edit</a>";//this does not work..
?>
</body>
please anyone help me.. where is my mistake?
Upvotes: 0
Views: 227
Reputation: 231
Correct value "
<input id="btn" type="button" value="hide/show" onclick="onHide()" />
And Use below script
<script>
function onHide()
{
alert("hide");
$("#txt").toggle();
}
</script>
Also include jQuery
if not included on the page
Upvotes: 1
Reputation: 94
Mistake in syntax:
Your wrote:
type="button" "value="hide/show"
But need:
type="button" value="hide/show"
Upvotes: 0