Pessoal, é o seguinte, estou fazendo uma página onde eu tenho um select com 2 opções,
Se eu escolher a primeira opção eu chamo uma lista do tipo A, caso seja o outro eu chamo uma lista do tipo B
Essas listas eu carrego no meu outro select, segue os codigos.
<%@page import="modelo.Funcionario"%>
<%@page import="modelo.Fornecedor"%>
<%@page import="java.util.List"%>
<%@page import="fachada.Fachada"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="css/style.css">
<title>La Pizza - Pagamento</title>
<%
Fachada fachada = Fachada.obterInstancia();
List<Fornecedor> fornecedores = fachada.pesquisarFornecedor("FROM Fornecedor");
%>
<style type="text/css">
#apDiv1 {
position:absolute;
width:100%;
height:91px;
z-index:1;
left: 0;
top: 0;
background-image: url(images/info_topo.png);
background-repeat:no-repeat;
background-color: #FE9900;
text-align: right;
font-weight: bold;
color: #FFF;
font-size: 36px;
}
</style>
</head>
<body>
<div class="info">Pagamentos > Funcionários e Fornecedores</div>
<div class="divForm">
<form action="PagamentoServlet?acao=FazerPagamento" method="post">
<table align="center" class="addForm">
<tr>
<td width="126"><label>Valor a ser Pago</label></td>
<td width="250" class="table"><input type="text" name="valorPago">
*</td>
</tr>
<tr>
<td>Tipo de Pessoa</td>
<td class="table"><label for="tipo"></label>
<select name="tipo" id="tipo">
<option>Funcionario</option>
<option>Fornecedor</option>
</select></td>
</tr>
<tr>
<td><label>Nome</label></td>
<td class="table"><label for="nome"></label>
<select name="nome" id="nome">
<% for(int i = 0; i < fornecedores.size(); i++){ %>
<option><%=fornecedores.get(i).getNome() %></option>
<% } %>
</select></td>
</tr>
<tr>
<td colspan="2" align="center"><input name="ok" type="submit" id="ok" value="OK">
<a href="javascript:history.back();">
<input name="cancelar" type="button" id="cancelar" value="Cancelar">
</a></td>
</tr>
</table>
</form>
</div>
</body>
</html>
Comecei a fazer o JQuery saiu +/- isso, testei mas não funcionou, então queria a ajuda de vocês... Obrigado, agradeço a quem puder ajudar!
$("document").ready(function(){
if($("#tipo").find("option").filter(":selected").val() == 'Fornecedor'){
}
});
