I am trying to insert a value using Jquery's `.val()` function - 

```
$("myDob").val(birthDate);

```

Now I want to implement a logic like this -

```
if (insertion of value is successful) 
{
   Do something
}

Otherwise
{
   Do something else
}

```

How do I implement this? I basically want to handle a scenario where the insertion of value fails.

Thanks in advance!