2012-03-01 142 views
0

我正在開發新的.net和使用jQuery。我試圖隱藏/顯示我的網頁上的下拉列表和複選框。我可以成功地躲起來,但是當我試圖表明沒有任何反應或者我得到一個錯誤在我的代碼是這樣的:如何使用jquery隱藏/顯示dropdownlist

http://imageshack.us/photo/my-images/811/sinttuloxs.jpg/

我試着用秀的形式型動物沒有任何成功。

$("#ddListaPrecios").Show(); 

$('#ddListaPrecios').Show('slow'); 

 $(document).ready(function() { 
      $("#ddListaPrecios").hide(); 

      $("#codigoCliente").autocomplete({ 
       minLength: 1, 
       source: getData, 
       select: function(event, ui) { 
        cambiaElementos(ui.item.value); 
        updateCiudades(ui.item.value); 
        updateListaVendedores(ui.item.value); 
        updateListaPrecios(ui.item.value); 
       } 
      }); 

      $("#codigoCliente").change(function() { 

       if ($("#codigoCliente").val().length == 6) { 
        cambiaElementos($("#codigoCliente").val()); 
        updateCiudades($("#codigoCliente").val()); 
        updateListaVendedores($("#codigoCliente").val()); 
        updateListaPrecios($("#codigoCliente").val()); 

        $("#ddListaPrecios").show(); 

       } 
      }); 

      $("#ddListaPrecios").change(function() { 
       //window.alert($("#ddListaPrecios").val()); 
       changePrecio($("#ddListaPrecios").val()); 

      }); 

      $("#ddCiudad").change(function() { 
       updatePuntosEntrega($("#codigoCliente").val(), $("#ddCiudad").val()); 

      }); 
     }); 



     <label>Lista de Precios: </label> 
     <label id="lbListaPrecios"> </label> 
     <%= Html.DropDownList("ddListaPrecios") %> 
     <!-- <%= Html.CheckBox("cbCambioLista") %> <label class="inline" for="cbCambioLista">Desea cambiar lista de precios?</label> --> 
+0

Ĵ avascript區分大小寫和jquery.Show不存在 – jbabey 2012-03-01 16:00:16

+0

我的博客http://blogs.msdn.com/b/rickandy/archive/2012/01/09/cascasding-dropdownlist-in-asp-net-mvc.aspx顯示這個。另請參閱查看我的DDL教程http://www.asp.net/mvc/tutorials/javascript/working-with-the-dropdownlist-box-and-jquery/using-the-dropdownlist-helper-with-aspnet-mvc – RickAndMSFT 2012-03-01 23:01:07

回答

0

您對jQuery的通話$("#ddListaPrecios").Show();需要像這樣$("#ddListaPrecios").show();

全部小寫在這裏看到的文檔http://api.jquery.com/show/

+0

仍然不起作用 – 2012-03-01 15:57:06

+0

@AlejandroHinestrosa現在你應該得到一個不同的錯誤,因爲這是你的截圖錯誤的原因。你可以在http://jsfiddle.net上設置一個例子 – Henesnarfel 2012-03-01 15:58:25

+0

我只是改變爲.show(),但仍然沒有任何反應,但我沒有看到任何錯誤消息 – 2012-03-01 16:03:01