Search found 117 matches

by admin
Thu Aug 22, 2019 2:45 pm
Forum: JavaScript, jQuery, ES6+
Topic: How to add/remove class names from elements in javascript or es6 using className?
Replies: 0
Views: 1070

How to add/remove class names from elements in javascript or es6 using className?

To a single element: var el = document.getElementById('#foo'); el[i].className = 'my-dynamic-class'; But that’ll override the existing class, the following appends it to the old classes: var el = document.getElementById('#foo'); el[i].className += ' my-dynamic-class'; Or: el.className = d.className ...
by admin
Thu Aug 22, 2019 2:42 pm
Forum: JavaScript, jQuery, ES6+
Topic: How to add/remove class names from elements in javascript or es6 using classList?
Replies: 0
Views: 1021

How to add/remove class names from elements in javascript or es6 using classList?

var el = document.getElementById("div1"); // Single class el.classList.add("my-class"); // Multiple classes el.classList.add("my-class", "another-class"); It has other methods also: add – Adds a class to an element’s list of classes. If class already exists in the element’s list of classes, it will...
by admin
Thu Aug 22, 2019 2:41 pm
Forum: HTML CSS
Topic: How to post data to an Iframe?
Replies: 0
Views: 1960

How to post data to an Iframe?

Post data to an Iframe Doesn't take any JavaScript or anything. You just have the form's target attribute match the iframe's name attribute. <form action="iframe.php" target="my-iframe" method="post"> <label for="text">Some text:</label> <input type="text" name="text" id="text"> <input type="submit"...
by admin
Thu Aug 22, 2019 2:40 pm
Forum: HTML CSS
Topic: What is Responsive Meta Tag and how to use it?
Replies: 0
Views: 1678

What is Responsive Meta Tag and how to use it?

I tend to use this: <meta name="viewport" content="width=device-width"> Although I see this is recommended a lot: <meta name="viewport" content="width=device-width, initial-scale=1"> This means that the browser will (probably) render the width of the page at the width of its own screen. So if that s...
by admin
Thu Aug 22, 2019 2:38 pm
Forum: HTML CSS
Topic: How to Open Link in a New Window?
Replies: 0
Views: 1762

How to Open Link in a New Window?

HTML attribute (valid in HTML5 now): <a href="http://chriscoyier.net" target="_blank">This link will open in new window/tab</a> #Inline JavaScript way: <a href="http://chriscoyier.net" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;">This link will o...
by admin
Thu Aug 22, 2019 2:36 pm
Forum: HTML CSS
Topic: How to add html class for just only internet explorer?
Replies: 0
Views: 1686

How to add html class for just only internet explorer?

<!--[if IE ]> <body class="ie"> <![endif]--> <!--[if !IE]>--> <body> <!--<![endif]--> Now you can write IE specific styles in a regular stylesheet, by prefacing the CSS selectors with .ie Or more robust version putting class on HTML element: <!DOCTYPE html> <!--[if IEMobile 7 ]> <html dir="ltr" lan...
by admin
Thu Aug 22, 2019 2:34 pm
Forum: HTML CSS
Topic: How to Prevent Search Engine Bots to Index Any Page Using Meta Tag in HTML?
Replies: 0
Views: 1784

How to Prevent Search Engine Bots to Index Any Page Using Meta Tag in HTML?

To prevent all search bots from indexing a page: <meta name="robots" content="noindex"> To prevent just Google: <meta name="googlebot" content="noindex"> If you have control over it, you probably want to add nofollow to links that point to that page as well: <a href="privatepage.html" rel="nofollow"...