Click here to Skip to main content
15,889,527 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: Looping through elements, to find textbox, and get values Pin
Andrei Straut9-Aug-12 9:37
Andrei Straut9-Aug-12 9:37 
GeneralRe: Looping through elements, to find textbox, and get values Pin
jkirkerx9-Aug-12 10:18
professionaljkirkerx9-Aug-12 10:18 
GeneralRe: Looping through elements, to find textbox, and get values Pin
Andrei Straut9-Aug-12 10:35
Andrei Straut9-Aug-12 10:35 
AnswerRe: Looping through elements, to find textbox, and get values Pin
Andy Brummer9-Aug-12 10:26
sitebuilderAndy Brummer9-Aug-12 10:26 
GeneralRe: Looping through elements, to find textbox, and get values Pin
jkirkerx9-Aug-12 16:54
professionaljkirkerx9-Aug-12 16:54 
GeneralRe: Looping through elements, to find textbox, and get values Pin
Andy Brummer10-Aug-12 4:56
sitebuilderAndy Brummer10-Aug-12 4:56 
GeneralRe: Looping through elements, to find textbox, and get values Pin
jkirkerx10-Aug-12 6:31
professionaljkirkerx10-Aug-12 6:31 
QuestionGet value from textbox created with createElement Pin
jkirkerx6-Aug-12 15:48
professionaljkirkerx6-Aug-12 15:48 
Well I'm getting bolder here with Javascript.

This eludes me, I can create a element and set the value no problem, I can get the value via Jquery no problem if the element is pre-dom, but if I create an element with createElement, I was thinking since my element is new in the DOM, it would be easy to retrieve the value via function. I'm missing something really basic here in principal, and this is the first time I have created a textbox this way.

It's written to be compatible with IE and Firefox browsers at the same time, in a single version.

I keep getting 'undefined' as the value of the code textbox. The function works, I just can't the appendCode from the textbox.

I've tried 3 versions so far. Just thought I'd ask, tomorrow I will have a fresh hat on to think with.

The Element
var txt_Element_L1_Code_Field = document.createElement("input");
    txt_Element_L1_Code_Field.id = "_txt_Element_L1_Code_Field_" + dynamicCart_Element1.idx;
    txt_Element_L1_Code_Field.type = "text";
    txt_Element_L1_Code_Field.style.paddingLeft = "5px";
    txt_Element_L1_Code_Field.style.width = "90%";
    txt_Element_L1_Code_Field.style.backgroundColor = "rgb(255,255,255)";   
    td_Element_L1_Code_Field.appendChild(txt_Element_L1_Code_Field);


Version 1 function that is binded
txt_Element_L1_Code_Field.onkeydown = function () {
        var appendCode;
        if (txt_Element_L1_Code_Field.innerText != "") {
            appendCode = txt_Element_L1_Code_Field.value;
        }

        span_Element_L1_CPN_Field.innerText = appendCode;
        span_Element_L1_CPN_Field.innerHTML = appendCode;
    };


Version 2: function that is binded
txt_Element_L1_Code_Field.onkeydown = function () {
        var appendCode;
        if (txt_Element_L1_Code_Field.innerText != "") {
            appendCode = txt_Element_L1_Code_Field.innerText;
        }
        else if (txt_Element_L1_Code_Field.innerHTML != "") {
            appendCode = txt_Element_L1_Code_Field.innerHTML;
        }

        span_Element_L1_CPN_Field.innerText = appendCode;
        span_Element_L1_CPN_Field.innerHTML = appendCode;    
    };

Version 3:
I lost it, gone
AnswerRe: Get value from textbox created with createElement Pin
BobJanova7-Aug-12 0:12
BobJanova7-Aug-12 0:12 
GeneralRe: Get value from textbox created with createElement Pin
jkirkerx7-Aug-12 6:24
professionaljkirkerx7-Aug-12 6:24 
AnswerRe: Get value from textbox created with createElement Pin
twseitex7-Aug-12 8:25
twseitex7-Aug-12 8:25 
GeneralRe: Get value from textbox created with createElement Pin
jkirkerx8-Aug-12 10:54
professionaljkirkerx8-Aug-12 10:54 
Questionadapt datatable jquery to jee application Pin
ahmadiss4-Aug-12 23:34
ahmadiss4-Aug-12 23:34 
AnswerRe: adapt datatable jquery to jee application Pin
Richard MacCutchan5-Aug-12 1:24
mveRichard MacCutchan5-Aug-12 1:24 
Questionshowmodaldialog return value undefined across domain Pin
Amr M. K.4-Aug-12 23:24
Amr M. K.4-Aug-12 23:24 
AnswerRe: showmodaldialog return value undefined across domain Pin
jkirkerx5-Aug-12 11:05
professionaljkirkerx5-Aug-12 11:05 
GeneralRe: showmodaldialog return value undefined across domain Pin
Amr M. K.6-Aug-12 22:05
Amr M. K.6-Aug-12 22:05 
AnswerRe: showmodaldialog return value undefined across domain Pin
BobJanova5-Aug-12 23:43
BobJanova5-Aug-12 23:43 
GeneralRe: showmodaldialog return value undefined across domain Pin
Amr M. K.6-Aug-12 21:26
Amr M. K.6-Aug-12 21:26 
QuestionEvalulating and passing RGB values from keydown Pin
jkirkerx2-Aug-12 8:12
professionaljkirkerx2-Aug-12 8:12 
AnswerRe: Evalulating and passing RGB values from keydown Pin
enhzflep2-Aug-12 9:58
enhzflep2-Aug-12 9:58 
GeneralRe: Evalulating and passing RGB values from keydown Pin
jkirkerx2-Aug-12 11:54
professionaljkirkerx2-Aug-12 11:54 
AnswerRe: Evalulating and passing RGB values from keydown Pin
BobJanova5-Aug-12 23:31
BobJanova5-Aug-12 23:31 
GeneralRe: Evalulating and passing RGB values from keydown Pin
jkirkerx6-Aug-12 7:22
professionaljkirkerx6-Aug-12 7:22 
GeneralRe: Evalulating and passing RGB values from keydown Pin
BobJanova7-Aug-12 0:11
BobJanova7-Aug-12 0:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.