Loading CSS file with JavaScript
Topics related to client-side programming language.
Post questions and answers about JavaScript, Ajax, or jQuery codes and scripts.
-
Marius
- Posts:107
Loading CSS file with JavaScript
Hello
I use the following jQuery code to include a css file in html page, but it doesn't work.
Code: Select all
var fcss ='address/file.css';
jQuery('head').append('<style type="text/css">' + fcss + '</style>');
How can I load a css file using javascript /jquery?
Admin
Posts:805
Hello
To include a css file in html document, use the <link> tag (not <style>).
You can use this javascript code:
Code: Select all
var fcss ='address/file.css';
document.querySelector('head').insertAdjacentHTML('beforeend', '<link rel="stylesheet" href="'+ fcss +'" type="text/css" />');
Similar Topics
- GET_id not working in UnLink (delete file)
PHP - MySQL
First post
I searching for an hour for a solution; unlink seems not to work with GET id
<?php
$id = (int) $_GET ;
echo $_GET ;
$file = fopen( '.$_GET...
Last post
Here is an answer `o god after 2 hours shame on me for this one`
<?php
$file_pointer = $_GET .'.txt';
if (!unlink($file_pointer)) {
echo (...
- Hour and Minutes togheter in Javascript
JavaScript - jQuery - Ajax
First post
Dear Coursesweb I can not find out how to add the hours + minutes togheter.
<SCRIPT LANGUAGE= JavaScript >
day = new Date()
hr =...
Last post
See and use the following example:
<script>
var day = new Date();
let hr = day.getHours();
let mn = day.getMinutes();
let se =...
- Display message to every minute in Javascript
JavaScript - jQuery - Ajax
First post
Hello,
On eatch minute from the current hour I wanna have an message
I can not find out how to complete
I hope to get something like this (code...
Last post
If you only want to display a message to every minute, just use the setInterval() function. It calls a function repeatedly, over and over again, at...