1

I am using prototype JavaScript library 1.7.2 in my project.But when i open in IE11 its give me below error for createElement code of JavaScript. Also not working in other browser. Only IE11 debugger show this error

code : var el = document.createElement('<input name="x">');

Error : InvalidCharacterError

2 Answers 2

1

It's native client-side Javascript, so it seems unrelated to PrototypeJS to me. The correct syntax is

var el = document.createElement('input');
el.name = "x";
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for answer. I know correct syntax for create input element but in prototype js HAS_EXTENDED_CREATE_ELEMENT_SYNTAX function create input element using above syntax. Can i change code in prototype js ?
Seems that Microsoft removed support for their proprietary createElement syntax in IE9. See here. What's more, it seems that their documentation is not up-to-date, i.e. there's a discrepancy between the description of the example code and the code itself.
0

To create elements like you are referring to in PrototypeJS you would do it like this :

var el = new Element('input',{'name':'x'});

This will work across all browsers that PrototypeJS supports

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.