Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1099477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:44:32+00:00 2026-05-17T00:44:32+00:00

Say i have a table row with the two text boxes and i want

  • 0

Say i have a table row with the two text boxes and i want to manipulate them based on the screens and some array values

                            <tr id ="myrow" style="display:none">
    <td>
      test1<input type="text" name="some" value ="some">
      test2<input type="text" name="test2" value ="test2">
    </td>
    </tr>

i am using the same form for all the screens .same form is being rendered for all screens so iam having a hidden value iam manipulating the things based on hidden

  var somearr = ['AAA','BBB','CCC','DDD'];
  //ready function 
  if ($("#hi_showelements").attr('value')=="screen1"){
      $("#firsttd").removeAttr('style'); //we have the td but not shown above

  }
  else if($("#hi_showelements").attr('value')=="screen2"){
     $("#myrow").hide();

  else if($("#hi_showelements").attr('value')=="screen3"){
      $("#myrow").hide();

  }
  else if ($("#hi_showelements").attr('value')=="screen4"){
   $("#myrow").hide();

  }

  if($.inArray(somecode,somearr)=='-1'){
     $("#myrow").hide();

   }
  else{
   $("#myrow").show();
  }

the above row “myrow” is hidden correctly in the scrren1,screen2,screen3,screen4, .
But my problem is i cannnot hide the row in the same screens
say if “somecode” value is “AAA” which is present in the “somearr ”
array and which is not equal to “-1” and the “#myrow” is being shown .
How can i hide this row if the “somecode” is present in the “somearr”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:44:32+00:00Added an answer on May 17, 2026 at 12:44 am

    What you’re trying to do should already work. If it isn’t, you should first clean up your code so that it’ll be easier to spot errors.

    First, I’d suggest replacing the first bunch of if statements with a switch:

    switch ($("#hi_showelements").attr('value')) {
      case 'screen1':
        $("#firsttd").removeAttr('style');
        break;
    
      case 'screen2':
      case 'screen3':
      case 'screen4':
        $("#myrow").hide();
        break;
    }
    

    Next, inArray returns an integer, not a string. Just because JavaScript allows you to do compare strings with integers doesn’t mean it’s a good idea. Use something like this:

    if($.inArray(somecode,somearr) == -1)
       $("#myrow").hide();
    else
       $("#myrow").show();
    

    If it still doesn’t work, maybe somecode isn’t set properly. We would need to see where you define it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say you have a table for branches in your organization. Some of them
We have table with several full text indexed fields. Say, it is firstName, surName
Let's say I have two tables: Table 1 has the columns NOTE_ID (a unique
I have two tables, say teacher and student. I want to build a third
Say I have a table called myTable. What is the SQL command to return
Say I have a table called xml that stores XML files in a single
Say I have this table: Person table -------------- PersonId Address table ------------ AddressId PersonAddressId
Lets say I have a table in a sql server 2000 database called TransactionType:
Let's say I have a table that represents a super class, students . And
Let's say I have a table like this: name | score_a | score_b -----+---------+--------

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.