• 24-01-2024, 09:58:21
    #1
      $('input').keypress(function() { //alert("test");
        var dInput = $(this).val().replace(",",".");
        $(this).val(dInput);
      });
          <div id="upload_div" class="mt-3">
                <input class="inbox form-control" type="text" name="processLabel[]" id="processLabel[]" value="" onkeypress="return event.charCode >= 40 && event.charCode <= 57">
            </div>
    Merhaba, inputu girerken virgülü noktaya çevirmiyor input formları. kodda bir hata mı var ? yardımcı olabilirseniz sevinirim.
  • 24-01-2024, 10:03:14
    #2
    $('input#processLabel').keypress(function() {
      const dInput = $(this).val().replace(",",".");
      $(this).val(dInput);
    });
    <div id="upload_div" class="mt-3">
          <input class="inbox form-control" type="text" name="processLabel[]" id="processLabel" value="" onkeypress="return event.charCode >= 40 && event.charCode <= 57">
      </div>
  • 24-01-2024, 10:05:05
    #3
    document.getElementById("processLabel[]").addEventListener("keydown", function(event) {
        if (event.key === ",") {
            event.preventDefault();
            const selectionStart = event.target.selectionStart;
            const selectionEnd = event.target.selectionEnd;
            const inputValue = event.target.value;
            const modifiedValue = inputValue.substring(0, selectionStart) + '.' + inputValue.substring(selectionEnd);
            event.target.value = modifiedValue;
            event.target.setSelectionRange(selectionStart + 1, selectionStart + 1);
        }
    });
    dener misin
  • 24-01-2024, 10:11:00
    #4
    lancelot adlı üyeden alıntı: mesajı görüntüle
    $('input#processLabel').keypress(function() {
      const dInput = $(this).val().replace(",",".");
      $(this).val(dInput);
    });
    <div id="upload_div" class="mt-3">
          <input class="inbox form-control" type="text" name="processLabel[]" id="processLabel" value="" onkeypress="return event.charCode >= 40 && event.charCode <= 57">
      </div>
    işe yaramadı hocam
  • 24-01-2024, 10:11:41
    #5
    lancelot adlı üyeden alıntı: mesajı görüntüle
    $('input#processLabel').keypress(function() {
      const dInput = $(this).val().replace(",",".");
      $(this).val(dInput);
    });
    <div id="upload_div" class="mt-3">
          <input class="inbox form-control" type="text" name="processLabel[]" id="processLabel" value="" onkeypress="return event.charCode >= 40 && event.charCode <= 57">
      </div>
    v4r1able adlı üyeden alıntı: mesajı görüntüle
    document.getElementById("processLabel[]").addEventListener("keydown", function(event) {
        if (event.key === ",") {
            event.preventDefault();
            const selectionStart = event.target.selectionStart;
            const selectionEnd = event.target.selectionEnd;
            const inputValue = event.target.value;
            const modifiedValue = inputValue.substring(0, selectionStart) + '.' + inputValue.substring(selectionEnd);
            event.target.value = modifiedValue;
            event.target.setSelectionRange(selectionStart + 1, selectionStart + 1);
        }
    });
    dener misin
    hocam buda yalnızca ilk satır için değişim yapıyor. diğerlerini değiştirmiyor
  • 24-01-2024, 10:21:15
    #6
    pilavustuketcap adlı üyeden alıntı: mesajı görüntüle
    işe yaramadı hocam
    https://jsfiddle.net/urp3xdhf/ çalışıyor hocam. Siz bir yerde bir hata yapıyorsunuz. Ayrıca formda name = processLabel[] olan tüm inputlarda çalışması için JS kısmını aşağıdaki gibi değiştirebilirsiniz:
     $('input[name="processLabel[]"]').keypress(function() {
      const dInput = $(this).val().replace(",",".");
      $(this).val(dInput);
    });
  • 24-01-2024, 10:22:47
    #7
    ayrıca yapıştırma işlevinide kontrol altına almalısınız çünkü virgüllü bir şey yapıştırınca düzeltmiyor
  • 24-01-2024, 10:45:42
    #8
    $('input').keyup(function() {
        var dInput = $(this).val().replace(",",".");
        $(this).val(dInput);
    });
  • 24-01-2024, 13:01:20
    #9
    Kodunuzda
    $(document).ready(function () {
    });
    olan yerin içerisine koyun fonksiyonu. Ya da böyle bir yer yoksa
    $(document).ready(function () {
      $("input").keyup(function () {
        //alert("test");
        var dInput = $(this).val().replace(",", ".");
        $(this).val(dInput);
      });
    });
    yazın