Jump to content

onclick javascript not working..


MDanz

Recommended Posts

it should work... when i press the button a textarea should be displayed in the div "newreason".  It isn't working though.

 

	
<input type='button' onclick='newreason()' name='reasonbutton' value='Next reason' style='font-size:12px;' />

<div id='newreason'>
</div>


function newoutcome()
{
var htmlReason =  "<span class='font'>More Information</span><img src='arrowdown.jpg' /><br />
<textarea name='reason[]' style='font-size: 10px;width:500px; height:50px;' onFocus='if(this.value==\"type more information\") { this.value=\"\"}'>type more information</textarea>"; 
      		
var newElementone = document.createElement('div');

       
	newElementone.id = 'newreason1';

	newElementone.innerHTML = htmlReason;

  var fieldsAreaone = document.getElementById('newreason');
fieldsAreaone.appendChild(newElementone);

}

Link to comment
https://forums.phpfreaks.com/topic/233116-onclick-javascript-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.