Jump to content

Please help me with this assignment


Recommended Posts

<!DOCTYPE html>

<input type="text" id="clickSend" autofocus /><br>
<p id="contacts"></p>
Characters remaining: <input disabled  maxlength="3" size="3" value="160" id="counter"><br>
<textarea onkeyup="textCounter(this,'counter',160);" id="message">
Sent message: <p id="poruka"></p>
<button type="button" id="button" onclick="message()">Send</button>

function textCounter(field,field2,maxlimit)
 var countfield = document.getElementById(field2);
 if ( field.value.length > maxlimit ) {
  field.value = field.value.substring( 0, maxlimit );
  return false;
 } else {
  countfield.value = maxlimit - field.value.length;


var i = 1;

document.addEventListener("click", function createContact(){
	if(document.getElementById("clickSend").value !== '')
		var check = document.createElement('input');
		check.setAttribute('type', 'checkBox');
		check.setAttribute('id', 'number' + i);
		check.setAttribute('value', document.getElementById("clickSend").value);
		check.setAttribute('contactNumber', 'numbers');
		var labl = document.createElement('label');
		labl.setAttribute('for', 'number' + i);
		i= i + 1;


function message() {
	var msg=document.getElementById("message").value;


So, checked numbers wont display with the message from text area when send button is clicked. I tried lots of different solutions but neither of those helped. So please if you can help me with this. Thank you.

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...