I need to insert a function in my JSP that clears the value of the input when the user clicks to enter the value, but I can not insert class into the input, nor is Placeholder accepted nor Onclick, could anyone tell me any way to do?
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<SCRIPT>
function verificarEEnviar()
{
var dsEmail=document.captacaoEmailsForm["dsEmail"].value;
var atpos=dsEmail.indexOf("@");
var dotpos=dsEmail.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=dsEmail.length)
{
alert("Não é um endereço de e-mail válido");
}
else{
return document.captacaoEmailsForm.submit();
}
document.captacaoEmailsForm.reset();
}
</SCRIPT>
<div class="captacao">
<html:form action="/captacaoEmails" styleId="cadastroCliente2">
<div class="captacao-titulo">Cadastre-se e receba<span> ofertas exclusivas </span> </div>
<div class="captacao-email">
<html:text tabindex="5" property="dsEmail" maxlength="60" onClick="this.form.reset()" value="inserir seu email" />
<a href="javascript:verificarEEnviar();" id="btContinuar" class="captacao fr">Enviar</a>
<br>
<html:errors property="dsEmail" header="empty"/>
</div>
</html:form>
</div>