Ver Mensaje Individual
  #4 (permalink)  
Antiguo 27/05/2012, 08:48
Avatar de Naahuel
Naahuel
 
Fecha de Ingreso: marzo-2011
Ubicación: localhost
Mensajes: 796
Antigüedad: 13 años, 1 mes
Puntos: 192
Respuesta: Html, duda con <select>

:S

Eso ya es otro asunto. Lo harías con CSS.
http://jsbin.com/enumes

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <meta charset="utf-8" />
  3.  
  4.   <style>
  5.     #contenedor{
  6.       width: 300px;
  7.       margin: 0 auto;
  8.     }
  9.   </style>
  10.  
  11. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  12. <script type="text/javascript">
  13.     $(function(){
  14.         $('#preguntas').change(function(){
  15.             // acá realizo lo que quiero hacer cuando el select
  16.             // con id "preguntas" cambie.
  17.            
  18.             var valor = $(this).val();      //Obtengo el valor seleccionado
  19.             $('#resultado').text(valor)     //Aplico ese valor al elemento con id "resultado"
  20.         });
  21.     });
  22. <title>Select de prueba</title>
  23. </head>
  24.     <div id="contenedor">
  25.       <select id="preguntas">
  26.         <option>Seleccione una pregunta:</option>
  27.         <option value="Nahuel">&iquest;Cu&aacute;l es tu nombre?</option>
  28.         <option value="24">&iquest;Cu&aacute;ntos a&ntilde;os ten&eacute;s?</option>
  29.     </select>
  30.     <p id="resultado"></p>
  31.   </div>
  32. </body>
  33. </html>
__________________
nahueljose.com.ar