Results 1 to 2 of 2

Thread: Dynamically creating form rows with onclick events

  1. #1
    Join Date
    Sep 2009

    Dynamically creating form rows with onclick events

    Hi guys,

    I'm quite new to javascript. I wonder if anybody can help me.

    I've created a form which enters a new row (with form input fields) when you click 'Add row'.

    I've successfully got the onclick event to work on some of the form inputs. However, there is one that I am having difficulty with. Basically, the event isn't working.

    Here is the code which creates the cell in question.

    var cell1 = row.insertCell(0);
    cell1.width = "10%";
    var element1 = document.createElement("input");
    element1.type = "text";
    element1.maxlength = "10";
    element1.style.width = "52px";
    element1.name = "ProductCodeShort["+suffix+"]";
    element1.onclick = function(){

    I think is the 'this.value' which is causing the problem. I want the user to type in a product code in this field, and then the function returns the product title.

    I will change it to onkeyup when it's working.

    Thanks in advance for any help you can give.

    Kind Regards

  2. #2
    Join Date
    Sep 2009
    Apologies guys, this actually worked. I had made an error elsewhere...

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