如何在客户端隐藏和显示文本框. [英] How to hide and Show Textboxes in client side..

查看:81
本文介绍了如何在客户端隐藏和显示文本框.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有10个文本框,第一个文本框始终可见.如果用户在第一个文本框中输入任何值,则单击按钮(添加按钮)第二个文本框必须可见,依此类推;如果用户单击关闭按钮,则该特定div必须关闭,并且不应为空白. br/>
我希望在客户端使用此功能,请问有人可以帮忙吗?

***(2012年8月24日)***经过几天的挣扎,我可以使用JQuery进行操作,我是JQuery的新手,通过使用下面显示的代码并将其隐藏在Div上,但问题是-如果页面刷新,则所有div都将关闭.如果在文本框中有任何值可以显示Div,请问有什么机构可以帮助我解决此问题,

感谢您的帮助


I have 10 Text boxes, first text box is visible always. If the user enters any value in the first text box then click the button(add button) 2nd textbox has to visible and so on.If they click the close button that particular div has to close and it should not be a empty space.

I wanted this in client side, can any one help me please.

***(Aug 24 2012)*** After couple of days struggle I can able to do using JQuery, I am new to JQuery, by using the below code I am showing and Hiding the Div''s, but the problem is - if the page refreshes all div''s are closing. If there is any value in the text box that Div should be visible, Can any body help me to solve this please,

Appreciate your help


     $(document).ready(function() {
//         if ($("#ctl00_ContentPlaceHolder1_txtaddPhone2").val() == '''') { $(''#divphone2'').hide(); }
//         if ($("#ctl00_ContentPlaceHolder1_txtaddPhone3").val() != '''') { $(''#divphone3'').hide(); }
         $(''#divphone3'').hide();
         $(''#divphone2'').hide();  
         $(''#showr'').click(function() {            
             if ($("#ctl00_ContentPlaceHolder1_txtaddPhone1").val() != '''') { $(''#divphone2'').show("slow"); }
             if ($("#ctl00_ContentPlaceHolder1_txtaddPhone2").val() != '''') { $(''#divphone3'').show("slow"); }
             if ($("#ctl00_ContentPlaceHolder1_txtaddPhone3").val() != '''') { $(''#divphone4'').show("slow"); }
             if ($("#ctl00_ContentPlaceHolder1_txtaddPhone4").val() != '''') { $(''#divphone5'').show("slow"); }
         });
     });
     $(document).ready(function() {
         $(''#ctl00_ContentPlaceHolder1_hidr'').click(function() {
         $("#ctl00_ContentPlaceHolder1_txtaddPhone2").val('''');
         $(''#divphone2'').hide("slow");            
         });

         $(''#ctl00_ContentPlaceHolder1_hid2'').click(function() {
         $("#ctl00_ContentPlaceHolder1_txtaddPhone3").val('''');
         $(''#divphone3'').hide("slow");
          });
     });



谢谢,
Nag



Thanks,
Nag

推荐答案

(document).ready(function(){ //if(
(document).ready(function() { // if (


(#ctl00_ContentPlaceHolder1_txtaddPhone2").val()==``''){
("#ctl00_ContentPlaceHolder1_txtaddPhone2").val() == '''') {


(''#divphone2' ').隐藏(); } //如果((
(''#divphone2'').hide(); } // if (


这篇关于如何在客户端隐藏和显示文本框.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆