<?php
/**
* ChronoForms 8
* Copyright (c) 2023 ChronoEngine.com, All rights reserved.
* Author: (ChronoEngine.com Team)
* license:     GNU General Public License version 2 or later; see LICENSE.txt
* Visit http://www.ChronoEngine.com for regular updates and information.
**/
defined('_JEXEC') or die('Restricted access');
?>
<?php 
	$element["icon"] = ["name" => "eye link"];

	Chrono::addHeaderTag('
	<script type="text/javascript">
		document.addEventListener("DOMContentLoaded", e => {
			let input = document.querySelector("[name='.$element["fieldname"].']")
			input.closest(".field.holder").querySelector("svg.eye").addEventListener("click", e => {
				if (input.type === "password") {
					input.type = "text";
				} else {
					input.type = "password";
				}
			})
		})
	</script>');