Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Prueba de ocultado de campos</title>
- <meta name="description" content="The HTML5 Herald">
- <meta name="author" content="SitePoint">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
- </head>
- <body>
- <select id="miSelector" onchange="es_Campo_SPE()">
- <option value="normal">Normal</option>
- <option value="SPE">SPE</option>
- </select>
- <div class = "esCampoSPE">
- <p> Es un campo SPE </p>
- </div>
- <div class = "esCampoNormal">
- <p> Es un campo normal </p>
- </div>
- <script>
- $(document).ready(function() {
- es_Campo_SPE();
- });
- function es_Campo_SPE() {
- var campoTest = $("#miSelector").val();
- if( campoTest == "SPE") {
- $(".esCampoSPE").show();
- $(".esCampoNormal").hide();
- }
- else {
- $(".esCampoSPE").hide();
- $(".esCampoNormal").show();
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement