Daniel Christopher:
i want to 2D(active z value must assign to the vertex not elements z value) snap the vertex
It's not exactly clear what you want to do. But a user can snap only to a vertex, not some arbitrary point that happens to have the same XY coordinates as a vertex but a different Z value.
You must let the user snap to what she can snap to. After you have captured that snap point you can adjust the Z value in your code.