This question already has answers here:
How to change CSS property using JavaScript
(7 answers)
Closed last year.
i am trying to get rid of jQuery in my projects but i ran into an issue: editing CSS styles with vanilla js. in jQuery there is a function$("#anything").css("color", "red");. What is the equivalent of this function in vanilla JavaScript?
document.getElementById('anything').style.color = 'red';
See MDN.
Related
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
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
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.
This question already has answers here:
Lightweight alternative to jQuery for class / id selecting
(6 answers)
Closed 8 years ago.
I have this jQuery selector:
$('#stuffElements').find('[data-markerlayer="layer1"]');
I have a ton of selectors similar to this one, and I want to optimize my script as much as possible, as rewriting most selectors requires only minimal effort on my part.
Disregarding the discussion whether this is useful, is it possible to write the above selector out in pure JavaScript?
document.querySelectorAll('#stuffElements [data-markerlayer="layer1"]')
or to make it more efficient:
var holder = document.getElementById('#stuffElements'); // cache parent node
holder.querySelectorAll('[data-markerlayer="layer1"]'); // finds inside it
querySelectorAll doesn't work in IE7 if that bothers you.
This question already has answers here:
Scale and mirror SVG object
(5 answers)
Closed 7 years ago.
Anyone know how to make a drawn svg elements (rect, text, etc.) have themselves reflected?? With JavaScript/JQuery
Any example with provided code will be great
If there is a JQuery plugin for that will also be great
Try with this:
http://lea.verou.me/2011/06/css-reflections-for-firefox-with-moz-element-and-svg-masks/