The id element value could not be found

Posted by: jkshin0 on 26 August 2019, 4:29 am EST

    • Post Options:
    • Link

    Posted 26 August 2019, 4:29 am EST

    Hi

    in wj-input-number

    The id element value could not be found.

    How can I find the id value to use?

    I am working on a wijmo sample.

    [html]

    <wj-input-number id=“test_id” [isRequired]=“false” [(ngModel)]=“model.test”

    [ts]

    document.addEventListener(‘keydown’, function (e) {

    if (e.keyCode == 13) {

    e.preventDefault();

    let elem = document.activeElement;

    console.log(elem.id); //null value

    }

    });

    Thank you. Good work.

  • Posted 26 August 2019, 11:48 pm EST

    Hi,

    The reason that the element’s id is null because the document.activeElement does not contain the reference to the component but instead, it contains the reference to the input element of the component.

    To get the id of the InputNumber component, you may use the closest method of wijmo. Please refer to the code snippet and the sample below:

    document.addEventListener('keydown', e => {
    	if(e.keyCode === 13) {
            	e.preventDefault();
            	let elem = document.activeElement;
    		var inpElem = wjcCore.closest(elem, '.wj-inputnumber');
    		console.log(inpElem.id);
    	}
    });
    

    https://stackblitz.com/edit/ckkyne-jkvhfl

    Regards,

    Ashwin

  • Posted 27 August 2019, 12:20 am EST

    Oh! Thank you very much.

    I haven’t been looking for a long time and asked,

    Please solve it.

    Thank you again.

  • Posted 27 August 2019, 11:22 pm EST

    Hi,

    I think that your issue is resolved so I am marking the solution as the answer. Let me know if you have any additional queries.

    ~regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels