Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Add event handler on field doesn't work

$
0
0

Hi everyone!

I want to add an onclick event handler on a field , so that when clicked (or focus) to hide an element.

Here is my code:

function setOnFocus()
{
    var preferredResource = document.getElementById("ral_preferredresource");

	if (preferredResource){
		alert("on click");
		preferredResource.attachEvent("onclick", hideFormAssistant);
	}

}



function hideFormAssistant()
{
  alert("in hideformassistant");
  document.getElementById('tdRelatedInformationPane').style.display = 'none';
}


Any ideas why it doesn't work? It errors on this line 

preferredResource.attachEvent("onclick", hideFormAssistant);

Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>