f



How to reset onclick event?

I attempted to reset the onclick event action at Line 13 and 14 below but it had no effect.  What's the correct way to do it?  

Thanks.


	Line 1: var config = function() {
	Line 2: 	// display config / usage info but no dupe display
	Line 3: 	if (!document.getElementById('confinfo')) {
	Line 4: 		var i = document.createElement('info');
	Line 5: 			i.id = "confinfo";
	Line 6: 			i.style = "color:green";
	Line 7: 			i.innerHTML = "Info goes here...";
	Line 8: 			document.body.insertBefore(i,document.body.firstChild);	
	Line 9: 			
	Line 10: 			// hide the config / usage info to free up the real estate
	Line 11: 			var h = document.getElementById('usage').value = "Hide config / usage instructions";
	Line 12: 			 console.log('from top section: ' +h);	
	Line 13: 				h.onclick = null; 
	Line 14: 				h.onclick = function () {
	Line 15: 					console.log('hide clicked');
	Line 16: 				// document.getElementById('confinfo').style.display = "none";		
	Line 17: 				document.getElementById('confinfo').innerHTML = '';
	Line 18: 			 }
	Line 19: 		}
	Line 20: }
0
justaguy
10/30/2016 8:40:00 PM
comp.lang.javascript 38370 articles. 2 followers. javascript4 (1315) is leader. Post Follow

2 Replies
413 Views

Similar Articles

[PageSpeed] 35

justaguy <lichunshen84@gmail.com> wrote on 30 Oct 2016 in
comp.lang.javascript: 

> I attempted to reset the onclick event action at Line 13 and 14 below
> but it had no effect.  What's the correct way to do it?  

Please do not start a second thread on the same subject.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
0
Evertjan
10/30/2016 9:22:17 PM
On Sunday, October 30, 2016 at 5:22:22 PM UTC-4, Evertjan. wrote:
> justaguy > wrote on 30 Oct 2016 in
> comp.lang.javascript: 
> 
> > I attempted to reset the onclick event action at Line 13 and 14 below
> > but it had no effect.  What's the correct way to do it?  
> 
> Please do not start a second thread on the same subject.
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

My mistake, will remove it in a sec.
0
justaguy
10/30/2016 10:02:47 PM
Reply: