I have two input in example and after add new input remove(or empty) values they now want not remove value a input, how is it?
Example: http://jsfiddle.net/3SmyE/
my try:
$clone.find('input').not(':has(name="family_un[]")').val('');
Full js code:
$(function () {
$('a.add_input').live('click', function (event) {
event.preventDefault();
var $this = $(this),
$div = $this.closest('.add_units'),
$clone = $div.clone().hide().insertAfter($div).fadeIn('slow');
$clone.find('.adda').not(':has(.remove_input)').append('<div class="mediumCell"><a href="" class="remove_input"></a></div>');
$clone.find('input').not(':has(name="family_un[]")').val('');
$this.remove();
console.log($('.add_units:last input:checkbox').prop('name'));
});
});
After applying my knowledge of cryptography, I’ve found the solution to your question.
Fiddle: http://jsfiddle.net/3SmyE/1/
Your current code:
Fixed code:
The
:has()pseudo-selector which selects child elements of the preceding selector. To select attributes, you have to suround the attribute by square bracelets, in the following format:[attribute="value"].