Adding 'isValid' method for checking element presence in DOM