Click here to Skip to main content
15,797,062 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Any one please provide me the code for Jquery..

if textbox1==100 then texbox2 and textbox3 is not visible.
If textbox1<100;then textbox2 is visible,
if textbox1+textbox2<100, then textbox3 is visible,

I am new in jquery so please help me how to write the code
Mohibur Rashid 19-Apr-13 4:14am    
$("#taxtboxid").val() this will return the value of text box, by the way, did you search on google before you stumped here
prodipjsr 19-Apr-13 4:21am    
yes sir & i hv written the code in my project but it is not working:::the code is==
<script type="text/javascript">
function TextBoxval(evt) {
var text1 = document.getElementById('<%= tbfirstper.ClientID %>');
var text2 = document.getElementById('<%= tbsecondper.ClientID %>');
var text3 = document.getElementById('<%= tbthirdper.ClientID %>');

var a = parseFloat(text1.value);
var b = parseFloat(text2.value);
var c = parseFloat(text3.value);

if (document.getElementById('<%= tbfirstper.ClientID %>').value == 100) {
$("#tbsecondnominee").attr("disabled", "disabled");
$("#tbsecondper").attr("disabled", "disabled");


if (document.getElementById('<%= tbfirstper.ClientID %>').value < 100)
tbsecondnominee.Enabled = true; tbsecondper.Enabled = true;

if ((document.getElementById('<%= tbfirstper.ClientID %>').value) + (document.getElementById('<%= tbsecondper.ClientID %>').value) < 100)
tbthitdnominee.Visible = true; tbthitdnominee.Visible = true;


prodipjsr 19-Apr-13 6:18am    
hello sir. please help me..

1 solution

<span id="s1">Enter value <input type="text" id="txt1" ><br /></span>
<span id="s2" style="display:none">Enter value <input type="text" id="txt2" ><br /></span>
<span id="s3" style="display:none">Enter value <input type="text" id="txt3" ><br /></span>
    $("#txt1,#txt2,#txt3").blur(function() {
      var v1 = $("#txt1").val(),
          v2 = $("#txt2").val();
      if(!isNaN(v1) ) {
        if(parseInt(v1,10) == 100) {
        else if(parseInt(v1,10) < 100) {
        if(!isNaN(v2) ) {
          if((parseInt(v2,10) + parseInt(v1,10) ) == 100) {
          else if((parseInt(v2,10) + parseInt(v1,10) ) < 100) {
Share this answer
prodipjsr 20-Apr-13 3:28am    
sir, please tell me why i am using s1,s2,s3..& where i am use this in my project..
my html code for the text box is bellow::

First Nominee Name <asp:TextBox ID="tbfirstnominee" style="text-transform:uppercase" runat="server">
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender8" runat="server" FilterType="LowercaseLetters,UppercaseLetters" TargetControlID="tbfirstnominee" />
  Percentage <asp:TextBox ID="tbfirstper" MaxLength="3" runat="server" Width="35px">
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender9" runat="server" FilterType="Numbers" TargetControlID="tbfirstper" />
<br />
<br />
Second Mominee Name <asp:TextBox ID="tbsecondnominee" style="text-transform:uppercase" runat="server">
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender12" runat="server" FilterType="LowercaseLetters,UppercaseLetters" TargetControlID="tbsecondnominee" />
  Percentage <asp:TextBox ID="tbsecondper" MaxLength="3" runat="server" Width="34px">
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender10" runat="server" FilterType="Numbers" TargetControlID="tbsecondper" />
<br />
<br />
Third Mominee Name <asp:TextBox ID="tbthitdnominee" style="text-transform:uppercase" runat="server">
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender13" runat="server" FilterType="LowercaseLetters,UppercaseLetters" TargetControlID="tbthitdnominee" />
  Percentage <asp:TextBox ID="tbthirdper" MaxLength="3" runat="server" Width="34px">
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender11" runat="server" FilterType="Numbers" TargetControlID="tbthirdper" />
<br />

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900