Hi 65sametkaya65,
Refer below code.
View
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<input type="text" id="txtName" />
<input type="button" value="Show" id="btnShowHide" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$("#btnShowHide").click(function () {
if ($("#txtName").attr('style') == 'display:none;') {
$("#txtName").attr('style','display:block;');
$("#btnShowHide").val("Hide");
}
else {
$("#txtName").attr('style', 'display:none;');
$("#btnShowHide").val("Show");
}
});
});
</script>
</body>
</html>
Controller
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
return View();
}
}
Screenshot