An exception occurred in the client script. Error: Cannot read property 'focus' of nu


I am using modal to add and edit a record. when i add a new one it works fine, but when i edit an existing one in the table, it makes the update but then throws this javascript exception. does anyone know what the cause is and how do I resolve this?


An exception occurred in the client script. Error: Cannot read property 'focus' of null

Stelio Simbine wrote:


I am using modal to add and edit a record. when i add a new one it works fine, but when i edit an existing one in the table, it makes the update but then throws this javascript exception. does anyone know what the cause is and how do I resolve this?


An exception occurred in the client script. Error: Cannot read property 'focus' of null

 There can be multiple reasons for this. A quick check can be to check the errors in dev tools for browser. Just hit F12 or open developer tools from the browser menu. Go to Console tab and just hit ctrl + F5. You should see more errors in there which would give more info on the error. 


Cheers,

Tushar

 

Hi Stelio,

Please share the javascript code you have for this, which would help.

But, looking at the error, I think you are trying to set focus to an element using javascript, something like below:

$(".ClassName").focus();

Where, element may not be available or element doesn't have 'focus' property to use.

Regards,

Karthik