Cannot read property 'target' of undefined from v2.js


Functionality failing and it was working for a year now...
Seems like a change introduced in v2.j, it's preventing Opt In link being returned from Hubspot based on our form integration and workflow with Hubspot.

To regenerate : use the following

    portalId: "SamplePortalD",
    formId: "SampleFormID",
    onFormReady: function($form, ctx) {
        jQuery('input[name="email"]').attr('readonly', 'readonly').change();

Getting the following error ( on the last line change() call highlighted in bold )
v2.js:10 Uncaught TypeError: Cannot read property 'target' of undefined
at t.handleChange (v2.js:10)
at r.notifyAll (v2.js:1)
at i.close (v2.js:3)
at i.closeAll (v2.js:4)
at i.perform (v2.js:4)
at i.perform (v2.js:3)
at Object.S [as flushBatchedUpdates] (v2.js:3)
at r.closeAll (v2.js:4)
at r.perform (v2.js:4)
at Object.batchedUpdates (v2.js:2)

Re-posting, as I have commented the same on recent post/issue where similar issue reported.


Hey @TIDEV, can you send over the page that this is happening on/ the original thread that you mentioned above? Thanks!



Thanks @TIDEV, can you send over the page that this this is happening on please? I won't be able to troubleshoot the issue without taking a look there. Please also send me your HubID! Thanks


Thanks, it’s a secured page and requires an account, Have provided the sample script and portal details … HubSpot Ticket #2058382


Thank you! Taking a look and will respond when I have an answer


Hi @TIDEV, this should be resolved. I'm going to lock this topic, and we can correspond on this one: Cannot read property 'target' of undefined from current.js