css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>測試刪除後,順序重新排列</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
	

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	

	
	
  </head>
  
  <body class="body">
  
  
	<div class="container">
		

							<div class="form-group">
								<label class="col-md-1 control-label">步驟</label>
								<div class="col-md-11">
									<table class="table table-bordered">
										<thead>
											<tr class="active">
												<th></th>
												<th>操作</th>
												<th>輸入</th>
												<th>結果</th>
												<th>型別</th>
												<th>輸出</th>
												<th></th>
											</tr>
										</thead>
										<tbody id="pnlSteps">
											<tr class="input-rows">
												<td><span class="txt-0">1</span></td>
												<td><input class="form-control txt-1"></td>
												<td><input class="form-control txt-2"></td>
												<td><input class="form-control txt-3"></td>
												<td><input class="form-control txt-4"></td>
												<td><input class="form-control txt-5"></td>
												<td><a class="btn btn-default btn-add">加入</a></td>
											</tr>
										</tbody>
									</table>
								</div>
							</div>

							<div class="form-group">
								<div class="col-md-8 col-md-offset-1">
									<button class="btn btn-default">新增</button>
								</div>
							</div>					
					</form>	
						
	
					</div>	
				</div>
			</div>
		</div>
    </div>
	
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
            
          
!
            
              $(document).delegate(".btn-add", "click", function(){
				var panel = $(this).parent("td").parent("tr").parent("tbody");
				var element = panel.children("tr:last").prop("outerHTML").replace(/value="(.+?)"/g, "");

				panel.append(element);
				$(this).html("移除");
				$(this).addClass("btn-remove");
				$(this).addClass("btn-danger");
				$(this).removeClass("btn-add");
				$(this).removeClass("btn-default");

				set_steps_index();
			});

			$(document).delegate(".btn-remove", "click", function(){
				var panel = $(this).parent("td").parent("tr").remove();
				set_steps_index();
			});

			function set_steps_index(){
				for(var i = 0; i <= $(".input-rows").length - 1; i++){
					$(".txt-0").eq(i).html(i+1);
					$(".txt-1").eq(i).attr("name", "action[" + i.toString() + "]");
					$(".txt-2").eq(i).attr("name", "input[" + i.toString() + "]");
					$(".txt-3").eq(i).attr("name", "result[" + i.toString() + "]");
					$(".txt-4").eq(i).attr("name", "type[" + i.toString() + "]");
					$(".txt-5").eq(i).attr("name", "output[" + i.toString() + "]");
					$(".txt-6").eq(i).attr("name", "output[" + i.toString() + "]");
					$(".txt-7").eq(i).attr("name", "output[" + i.toString() + "]");
					$(".txt-8").eq(i).attr("name", "output[" + i.toString() + "]");
					$(".txt-9").eq(i).attr("name", "output[" + i.toString() + "]");
				}
			}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console