What is the difference between data-ng and ng? [duplicate] - javascript

This question already has answers here:
What is the difference between ng-app and data-ng-app?
(7 answers)
Closed 9 years ago.
I have read that the difference between
ng-* and data-ng-*
in Angularjs is, that you get valid HTML if you use data-ng-*.
But why do I need that if I can declare the angular namespace in just one single line?
<html xmlns:ng="http://angularjs.org" ng-app>
Or is it just for validating with an HTML Validator?
Excuse my stupidity, but I'm really confused about this.

It's just for validation of your HTML. No other purpose.

Related

Textarea html tag with support `css` code [duplicate]

This question already has answers here:
Textarea that can do syntax highlighting on the fly?
(11 answers)
Closed 2 years ago.
I'm looking for textarea so I can write css code inside it. And have a good graphic appearance for displaying css code
As in the picture below:
There can be really one of two ways to do that: either you will implement it yourself OR use ready made libraries. Solutions like that exist in great variety and it could save you a lot of time to use one of following or find a similar one:
Edit Area
highlight.js
CodeMirror

Which alternative to use instead of document.write()? [duplicate]

This question already has answers here:
What are alternatives to document.write?
(11 answers)
Closed 3 years ago.
So guys, I made a little script to put in Tampermonkey for my presentations, but I have a problem.
What I want is to swap document.write(), but I don't know which function I could swap to replace it so that it leaves the code cleaner and more organized.
Besides document.write() is also not considered a good programming practice.
You could try to come up with your own function. But before taking any action, you need to think that there must be a injection into document body. You can try to use
document.body.appendChild()
and inside off that method, you can have some kind of html code.
Other than that you must generate a html document by using document.createDocumentFragment() or document.createElements().

AngularJS custom attributes [duplicate]

This question already has answers here:
Should I care about W3C validation?
(9 answers)
Closed 4 years ago.
I am new to angularjs. Just wanted to know that why does custom attributes which angularjs add to html element doesn't give any error? <div ng-if='true'>
Also, is it possible for us to create our own custom attributes for html elements?
Thanks.
They will not give an error because it is how they should be used and for your question about creating custom attributes I am almost sure that it is impossible

Why using "document.getElementById" instead of using the ID to refer to elements in JavaScript? [duplicate]

This question already has answers here:
Do DOM tree elements with IDs become global properties?
(5 answers)
What is the difference between getElementById and simply using an element's ID as a variable?
(2 answers)
Closed 5 years ago.
So, I was coding in class when accidentally got to this point, when you set any ID in HTML5 a global variable is created at the same time, which can be used on the script aparently the same way we use getElementById().
for example:
<div id="identifier"></div>
can be accessed in the script like:
identifier.style.whatever
Can anyone explain me why I can't find any information about this? also, why isn't anyone using this when coding? is it bad to use this instead of getElementById?

What is difference in JavaScript and jquery? [duplicate]

This question already has answers here:
What is the difference between JavaScript and jQuery? [closed]
(6 answers)
Closed 7 years ago.
I have 1 year of experience in ui devoloper and i have to sweech my compony,
SO when i attened 1st interview the interviewer ask me one question i.e.
In your application you use javascript or Jquery or both,so i am not give him a proper answer so please anyone give me the answer for this question.
Pure javascript also known as vanilla js (like a joke). And pure js works faster than frameworks based on js.
There is a compartment of frameworks and pure js http://vanilla-js.com/. But using frameworks is easier than pure js.

Categories