Pen Settings

HTML

CSS

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

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container-fluid">
	<button type="button" class="btn btn-primary btn-sm" id="add"><span class="glyphicon glyphicon-plus"></span>&nbsp;Adicionar Produto</button><br><br>

<form class="form form-inline" action="" method="post">	
<fieldset>
	
	<div class="form-group">						
		<div class="form-inline row margens">
		
	<div class="form-group col">
		<label for="prod_tipo" class="label label-small" style="color: black;">TIPO DE PRODUTO:</label><br>
			<select data-id="0" data-conta_campos="0" class="form-control custom-select prod_tipo" name="prod_tipo[]" id="prod_tipo" data-error="Por favor, selecione um produto." required >
				<option value="" >PRODUTO: </option>
				<option value="25.00" data-valor="25.00" >PRODUTO1 </option>
				<option value="30.00" data-valor="30.00" >PRODUTO2 </option>
				<option value="35.00" data-valor="35.00" >PRODUTO3 </option>
				<option value="40.00" data-valor="40.00" >PRODUTO4 </option>
				<option value="45.00" data-valor="45.00" >PRODUTO5 </option>
			</select>
		 <div class="help-block with-errors"></div>
	</div>
	
	<div class="form-group col">
		<label for="prod_valor" class="label label-small" style="color: black;">VALOR:</label><br>
			<div class="input-group">
				<span class="input-group-addon">R$</span>
				<input class="form-control dinheiro" id="0" name="prod_valor[]" type="text" value="" size="6" required>				
			</div>
			<div class="help-block with-errors"></div>
	</div>
			
		</div>
	</div><br>

	<div class="form-group">						
		<div class="form-inline row margens" id="produtos">
			
		<!-- INPUT'S DINAMICOS -->
			
		</div>
	</div><br>

	<div class="form-group">						
		<div class="form-inline row margens">
			
			<div class="form-group col">
		<label for="prod_valor" class="label label-small" style="color: black;">VALOR TOTAL:</label><br>
			<div class="input-group">
				<span class="input-group-addon">R$</span>
				<input type="text" name="valor_total" id="valor_total" class="form-control dinheiro"/>
			</div>
			<div class="help-block with-errors"></div>
	</div>
			
		</div>
	</div>
	
</fieldset>
</form>
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                $(document).ready(function(){
		$('body').on('change','.prod_tipo' , function() {
			var id = $(this).data('id');
			$('#' + id).val($(this).find(':selected').data('valor'));
		});
		
		$('body').on('change','.prod_tipo' , function() {
						
			function convertMoeda(n, c, d, t)
			{
				c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
				return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
			}
						
			var soma = 0;
			
			$(this).find(':selected').each(function(id, element){
				
			soma = soma + parseFloat($(element).data('valor'))
				
			})
			
			$('#valor_total').val(convertMoeda(soma));
			
		});
		
		var contar = 1;
		
		$("#add").on('click', function(){
			
		var select = '<div class="form-group"><div class="form-inline row margens">';
			select += '<div class="form-group col">';
		 	select += '<label for="vnd_tipo_vendedor" class="label label-small" style="color: black;">TIPO PRODUTO:</label><br><select data-id="' + contar + '" data-conta_campos="' + contar + '" class="form-control custom-select prod_tipo" name="prod_tipo[]" id="prod_tipo" data-error="Por favor, selecione um produto." required><option value="" >PRODUTO: </option><option value="25.00" data-valor="25.00" >PRODUTO1 </option><option value="30.00" data-valor="30.00" >PRODUTO2 </option><option value="35.00" data-valor="35.00" >PRODUTO3 </option><option value="40.00" data-valor="40.00" >PRODUTO4 </option><option value="45.00" data-valor="45.00" >PRODUTO5 </option></select>';
			select += '<div class="help-block with-errors"></div></div>';
			select += '&nbsp;<div class="form-group col">';
			select +='<label for="vnd_tipo_vendedor" class="label label-small" style="color: black;">VALOR:</label><br><div class="input-group"><span class="input-group-addon">R$</span><input id="' + contar + '" class="form-control dinheiro" id="prod_valor" name="prod_valor[]" type="text" value="" size="6" required></div>';
			select +='<div class="help-block with-errors"></div></div>';
			select +='&nbsp;<button type="button" class="btn btn-danger btn-sm del" id="add"><span class="glyphicon glyphicon-minus"></span>&nbsp;Remover</button></div></div>';
			
			contar++;
			
		$("#produtos").append(select);
			return false;
		});
		
		$(document).on('click', '.del', function(){
			$(this).parent().remove();
		});
	});
              
            
!
999px

Console