www.webdeveloper.com
Results 1 to 2 of 2

Thread: JS function that replace an element using it's id by a value

  1. #1
    Join Date
    Sep 2012
    Posts
    6

    Smile JS function that replace an element using it's id by a value

    Hello everyone,
    I am getting difficulties in writing a js function:
    " function replace(divId,argValue) " which take parameters id and value.The work of this function is that it should replace the value of a div(Known by it's id) by the argValue. Can anyone please help me.Thank you in advance.

  2. #2
    Join Date
    Jul 2011
    Posts
    127
    Code:
    function replace(id, arg) {
    	var div = document.getElementById(id);
    	if (div) {
    		div.innerHTML = arg;
    	}
    	return false
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles