Guide on detecting a paste event on a form using Vuejs in Safari

My Vuejs form has an input field for credit card numbers with the following attribute:

@change="updateNumber($event)"

While in Chrome, pasting a credit card number or autofilling from saved cards triggers a "change" event, it does not work the same way in Safari. The change event is not emitted. I am looking for guidance on which event to listen for and how to configure a custom event listener in my Vuejs component. Any help would be appreciated!

Answer №1

Forget about using @change, opt for @input instead to detect when a user pastes text into the input field.

Your revised code should look like this:

@input="updateNumber($event)"

Check out this functional example that I tried successfully in both Chrome and Safari browsers

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips to protect data from being erased when clicking the "Add New Address" button in ASP.Net Core

@model Registration @{ ViewData["Title"] = "Register Page - Step Two"; } <button type="button" class="btn btn-primary" onclick="addAddress()">Add Address</button> <div class="contai ...

The Redux store has been modified, yet the changes are not reflected in the

In my Posts.js component, I am mapping every object in the posts array. Within this function, I attempt to filter all notes that have the same post_id as the id of the current mapped post object and store them in a variable called filteredNotes. I then pas ...

Unable to successfully upload the image to Node.js

Client-Side Script $(document).ready(function(){ var fileSelected; console.log("Document Loaded"); $('#userPhotoInput').on('change', function(e){ fileSelected = e.target.files[0]; ...

How to store selected checkbox values in an array using AngularJS

Check out this code snippet: <tr ng-repeat="doc in providers"> <td><input type="checkbox" ng-true-value="{{doc.provider.Id}}" ng-false-value="" ng-model="ids"></td> </tr> {{ids}} I am trying to store the values of ...

Generating table rows dynamically using functions

I am working on a table where I need to dynamically add or remove rows. Each row contains a hyperlink in the last column to delete the record. Sometimes, if the record is not found in the database, this can cause issues as new rows are added dynamically af ...

Unable to retrieve file paths for assets using Node.js Server and Three.js

I am facing challenges when it comes to loading 3D models from a folder on my computer using a localhost node.js test server with the three.js library. Below is my app.js file that I execute via command line in the project directory using the 'node a ...

Using a custom jQuery function within an Angular component class

I have a custom query function that I wrote in a JavaScript file located under the source folder (/src/assets/inlineedit.js) of my Angular application. Here is the content of the file: $.fn.inlineEdit = function(replaceWith, connectWith) { $(this).ho ...

Using synchronous XMLHttpRequest on the main thread is no longer recommended when working with embedded JavaScript in code

I've implemented a basic Ajax function on my website, but I'm encountering a warning in the console. The warning states: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's expe ...

Tips for successfully implementing an Ocrad.js example

I've been working on an OCR (optical character recognition) web application and stumbled upon the Ocrad.js JavaScript library Ocrad.js. It seems like a perfect fit for what I need, but unfortunately, I'm having trouble getting it to function prop ...

Populate Chart.js with data retrieved using the $http.get() method

Looking to retrieve data from a webservice and present it in a chart, I decided to use Chart.js specifically with tc-angular-chartjs. The $http.get( ) call I'm using for testing is: $http.get('http://myjson.com/1chr1').success(function(data ...

Guide to refreshing a page (state) in a react application

As I delve into learning react.js, I decided to develop a basic rock paper scissors game within a react app. However, I've encountered some difficulty in creating a reload button that differs from the standard JavaScript button implementation which ty ...

JavaScript: Implementing a seamless spinning effect for an image [Compass needle]

I have been working on developing a compass app for mobile devices and have successfully created a function that returns the change-values for the compass-needle rotation (e.g. 20). However, I have noticed that setting the 'image-transform' to &a ...

Sending JavaScript variables to an ArrayList in a Java servlet

For instance, Let's say we have the following table: <table> <tr> <td>john</td> <td>doe</td> </tr> </table> This table can be dynamically generated. I am extracting values from the table using this ...

JavaScript's counterpart to Java's byteArray

I am currently exploring different encoding options in order to achieve the initial values of -1 or -40 for a jpeg file type. For the rest api I'm developing, it requires a byte array format like [-1, 94, 43, 34, etc]. In my node.js project, I'v ...

The failure of Internet Explorer to load in the $.ajax() function

I am currently working on a project where I have implemented a page that loads HTML content into a container using an $.ajax() request. This feature works flawlessly in Firefox, my trusty browser. However, it seems to be encountering issues in IE as the ex ...

Sending multiple arguments using a JavaScript .NET postback

I've successfully integrated a JavaScript function that enables me to perform a .NET (4.0) postback Javascript __doPostBack('__Page', argument) C# public void RaisePostBackEvent(string eventArgument) { //some action tak ...

One effective method for implementing two-way data binding with Vuex within a list

https://i.stack.imgur.com/xO2MO.png I have a collection of items stored in a Vuex state. The issue arises when I select items from the main state and update it using v-on:change, as well as from the sidebar. However, upon toggling down with v-on:change on ...

Ember Component Incorporating Keyboard Input

I recently developed an ember component that features a rectangular block in a green canvas. Everything is working smoothly so far. However, I am facing some challenges with implementing keyboard input commands (A S D W) to navigate the rectangle within t ...

Transferring a PHP array from HTML to JavaScript

I am trying to pass a PHP array to a JavaScript function when a button is clicked so that I can further send it through AJAX. Here is my current approach: html <a onclick="notify('<?= json_encode($my_array); ?>','news')" > ...

Implementing form validation for dropdown lists with Material-UI React: A comprehensive guide

I'm still learning React and I've been using material-ui for form validation. Everything was going smoothly until I encountered an issue with validating a dropdown list. Whenever I try to validate it, an error occurs: "Cannot read property ' ...