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

  • SEARCH
  • Home
  • 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 8830441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:05:20+00:00 2026-06-14T08:05:20+00:00

I have this append script that adds in a set of field on my

  • 0

I have this append script that adds in a set of field on my form. Based on the appended field, I would like for the “upg” select field to ONLY display if the valus for “status” is “Actual”. This condition should be applicable to all the appended field set so that if status1 is Actual I have a upg field but is status2 is Ghost, upg2 field should be hidden and so on. What do you guys suggest as the best way to do this?

    <script type="text/javascript">
    var count = 0;
    $(function(){
    $('a#add_field').click(function(){
    count += 1;

    $('#activation').append(
        '<div class="row-fluid">'                   
        +'<div class="span12" style="border-bottom:1px #dddddd; background-color:#e8e8e8; ">'

                +'<div style="float:left; width:7%;">'
                +'<label>&nbsp;</label>'                    
                +'<select name="status' + count + '" id="status' + count + '"  class="input-small">'
                +'<option value="Ghost">Ghost</option>'
                +'<option value="Actual">Actual</option>'
                +'</select>'
                +'</div>'

                +'<div style="float:left; width: 7%">'
                +'<label>Type</label>'
                +'<select id="upg' + count + '" name="upg' + count + '"  class="input-small" >'
                +'<option value="" selected="&nbsp;" >&nbsp;</option>'
                +'<option value="Exp" >Exp</option>'
                +'<option value="Post" >Post</option>'
                +'<option value="Upgrade" >Upg</option>'
                +'<option value="Retail" >Retail</option>'
                +'</select>'
                +'</div>'
         );     
      });   
});
  • 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-06-14T08:05:22+00:00Added an answer on June 14, 2026 at 8:05 am

    I personally find it easier to break up a complex set of html – especially one that uses some type of logic to determine the final dom – into multiple jquery objects. Although it’s slower to append multiple objects together, as opposed to doing it inline, sometimes it’s worth the clarity.

    Anyway, you need some data or setting that is determining the initial selected option of status, and you can use that same value to show/hide the corresponding upg. I would suggest you break it up into two appends, hide it before appending it to the dom so you dont see the upg select flash:

    var some_setting_or_db_val = 'ghost';
    
    var row = $('<div class="row-fluid">'                   
        +'<div class="span12" style="border-bottom:1px #dddddd; background-color:#e8e8e8; ">'
    
                +'<div style="float:left; width:7%;">'
                +'<label>&nbsp;</label>'                    
                +'<select name="status' + count + '" id="status' + count + '"  class="input-small">'
                +'<option value="Ghost">Ghost</option>'
                +'<option value="Actual">Actual</option>'
                +'</select>'
                +'</div>'
    
                +'<div style="float:left; width: 7%">'
                +'<label>Type</label>'
                +'<select id="upg' + count + '" name="upg' + count + '"  class="input-small" >'
                +'<option value="" selected="&nbsp;" >&nbsp;</option>'
                +'<option value="Exp" >Exp</option>'
                +'<option value="Post" >Post</option>'
                +'<option value="Upgrade" >Upg</option>'
                +'<option value="Retail" >Retail</option>'
                +'</select>'
                +'</div>');
    
    if(some_setting_or_db_val == 'ghost'){
        row.find("#upg" + count).hide();
    }
    
    $('#activation').append(row)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this PHP code that adds a set of nodes to an XML
i have this jquery script that is meant to append input boxes, its wont
I have this script $('head').append('<link rel=stylesheet href=css/file1.css type=text/css />'); $('head').append('<link rel=stylesheet href=css/jquery.jscrollpane.css type=text/css />');
atm I have something like this: $('#fish').append(<div data-bind='foreach: rows'> + <div ... + <p>...</p>..);
I have a list to which I append Axes3D plots. Like this: self.myList.append(self.axes.plot(xValues, yValues,
I have a code like this $(document).ready(function(){ $(.add).bind ('click', function () { $('.main').append('<div class=add>Add
I have this particular script that runs so that the flash elements don't show
I have found this script that expand image when mouse is over, but when
I have this script. I need is so that it only writes the links
I have this fragment that demonstrates the problem: <html> <head> <title>height query demo</title> <script

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.