jQuery UI Widgets Forums Editors DateTimeInput Disable text drag in input

This topic contains 2 replies, has 2 voices, and was last updated by  jamartinez 2 months, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Disable text drag in input #134501

    jamartinez
    Participant

    Hi all,

    Is there any way to disable the text input so, when I drag some selected text with the mouse, it doesn’t alter the date by accident? For example, I have an input with the date “20/03/2024” and I can select the year and accidentally drag the text to another position to make it read, say, “20/020243/”. Although the component checks for date validity this can make the interaction a bit confusing until the date is restored.

    The “readonly” flag doesn’t seem to fix this. The date must still be changeable through the dropdown calendar.

    Thanks in advance.
    Juan

    Disable text drag in input #134502

    ivanpeevski
    Participant

    Hi,

    You can prevent the ‘drop’ browser event like this:
    $(“#jqxDateTimeInput”).on(‘drop’, function(event) {
    event.preventDefault();
    });

    Best Regards,
    Ivan Peevski
    jQWidgets Team
    http://www.jqwidgets.com

    Disable text drag in input #134504

    jamartinez
    Participant

    Cheers Ivan, that solved my issue. Thank you very much!

    Regards.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.