Ich versuche, eine versteckte Schaltfläche auszulösen. Leider funktioniert das Event nicht. Hier ist der Code:Trigger versteckte Taste funktioniert nicht
<div class="dyn-inp-group">
<div class="dyn-inps">
<div class="form-group form-group-options col-xs-12 dyn-inp">
<div class="col-md-6" style="padding: 0 10px 0 0;">
<input class="form-control" class="customerfirstName" name="customer[firstName][]" type="text" placeholder="First name" required="required">
</div>
<div class="entry input-group col-md-6" style="margin: 0;">
<input class="form-control" name="customer[lastName][]" type="text" placeholder="Last name" required="required">
<span class="input-group-btn hidden">
<button id="remove" class="btn btn-info btn-remove" type="button">
<span class="glyphicon glyphicon-minus"></span>
</button>
</span>
</div>
</div>
</div>
<div class="form-group form-group-options col-xs-12 dyn-btn">
<div class="input-group col-xs-12">
<button id="countInput" class="btn btn-default" type="button">
<span class="glyphicon glyphicon-plus"></span> Add more
</button>
</div>
</div>
</div>
Ich zähle alle Eingaben, wenn Sie auf die Schaltfläche "Hinzufügen" klicken.
var customerCount= 1 ;
$("#countInput").click(function() {
var e = document.getElementsByTagName('input');
var i ;
var s = 1 ;
for(i=0; i < e.length; i++) {
if(e[i].type== "text" && e[i].name=="customer[firstName][]") { s++ ; }}
customerCount=s;
});
Ich habe auch eine Schaltfläche zum Entfernen. Der Entfernen-Button funktioniert nicht. Wenn ich auf die Schaltfläche zum Entfernen klicke, möchte ich die Eingabefelder erneut zählen.
$("#countInput").click(function() { This does not work
Irgendwelche Ideen?
Sind Sie möglicherweise die falsche Auswahl für Ihre Entfernen-Taste? sollte es '$ (" #remove ") sein. click (function() {'? – Hodrobond
können wir deinen css sehen? auch, hast du irgendwas damit zu tun? – 4lackof