Inserting a div into another static div for mobile Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience Should we burninate the [wrap] tag? The Ask Question Wizard is Live!How do I redirect to another webpage?How to insert an item into an array at a specific index (JavaScript)?How to check if a string “StartsWith” another string?Creating a div element in jQueryHow do I include a JavaScript file in another JavaScript file?How to move an element into another element?How to replace innerHTML of a div using jQuery?What is the best way to detect a mobile device in jQuery?Best place to insert the Google Analytics codeIs the recommendation to include CSS before JavaScript invalid?
How to do this path/lattice with tikz
iPhone Wallpaper?
What happens to sewage if there is no river near by?
Do I really need recursive chmod to restrict access to a folder?
Why is black pepper both grey and black?
How to find all the available tools in macOS terminal?
How much radiation do nuclear physics experiments expose researchers to nowadays?
Bonus calculation: Am I making a mountain out of a molehill?
Sorting numerically
List *all* the tuples!
What would be the ideal power source for a cybernetic eye?
Storing hydrofluoric acid before the invention of plastics
Did Xerox really develop the first LAN?
Output the ŋarâþ crîþ alphabet song without using (m)any letters
Models of set theory where not every set can be linearly ordered
What LEGO pieces have "real-world" functionality?
What is the musical term for a note that continously plays through a melody?
How does a Death Domain cleric's Touch of Death feature work with Touch-range spells delivered by familiars?
Gastric acid as a weapon
Problem drawing boxes with arrows in tikZ
How can players work together to take actions that are otherwise impossible?
ListPlot join points by nearest neighbor rather than order
Why does Python start at index -1 when indexing a list from the end?
Why constant symbols in a language?
Inserting a div into another static div for mobile
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
Should we burninate the [wrap] tag?
The Ask Question Wizard is Live!How do I redirect to another webpage?How to insert an item into an array at a specific index (JavaScript)?How to check if a string “StartsWith” another string?Creating a div element in jQueryHow do I include a JavaScript file in another JavaScript file?How to move an element into another element?How to replace innerHTML of a div using jQuery?What is the best way to detect a mobile device in jQuery?Best place to insert the Google Analytics codeIs the recommendation to include CSS before JavaScript invalid?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a WordPress site and I want to add second header line after the mobile header div.
When I insert the code in Chrome console with device toolbar as a mobile device, it works perfectly.
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
However when I try to add this code into header or footer section, it doesn't work. There is no problem with the implementation of js code.
javascript jquery
add a comment |
I have a WordPress site and I want to add second header line after the mobile header div.
When I insert the code in Chrome console with device toolbar as a mobile device, it works perfectly.
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
However when I try to add this code into header or footer section, it doesn't work. There is no problem with the implementation of js code.
javascript jquery
It sounds like you need to put your code in a document.ready event handler, or execute it just before the</body>
tag
– Rory McCrossan
Mar 8 at 16:36
Is there any error in the console on your mobile device?
– Ferrybig
Mar 8 at 16:40
add a comment |
I have a WordPress site and I want to add second header line after the mobile header div.
When I insert the code in Chrome console with device toolbar as a mobile device, it works perfectly.
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
However when I try to add this code into header or footer section, it doesn't work. There is no problem with the implementation of js code.
javascript jquery
I have a WordPress site and I want to add second header line after the mobile header div.
When I insert the code in Chrome console with device toolbar as a mobile device, it works perfectly.
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
However when I try to add this code into header or footer section, it doesn't work. There is no problem with the implementation of js code.
javascript jquery
javascript jquery
edited Mar 8 at 16:40
Rory McCrossan
251k29217254
251k29217254
asked Mar 8 at 16:34
Berk ŞENGÜLBerk ŞENGÜL
133
133
It sounds like you need to put your code in a document.ready event handler, or execute it just before the</body>
tag
– Rory McCrossan
Mar 8 at 16:36
Is there any error in the console on your mobile device?
– Ferrybig
Mar 8 at 16:40
add a comment |
It sounds like you need to put your code in a document.ready event handler, or execute it just before the</body>
tag
– Rory McCrossan
Mar 8 at 16:36
Is there any error in the console on your mobile device?
– Ferrybig
Mar 8 at 16:40
It sounds like you need to put your code in a document.ready event handler, or execute it just before the
</body>
tag– Rory McCrossan
Mar 8 at 16:36
It sounds like you need to put your code in a document.ready event handler, or execute it just before the
</body>
tag– Rory McCrossan
Mar 8 at 16:36
Is there any error in the console on your mobile device?
– Ferrybig
Mar 8 at 16:40
Is there any error in the console on your mobile device?
– Ferrybig
Mar 8 at 16:40
add a comment |
2 Answers
2
active
oldest
votes
$( document ).ready(function()
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
);
By default, JavaScript doesn't know when to execute: you have to tell it when. This example will execute on $(document).ready()
which means when the page is done loading.
add a comment |
Perhaps you need to wrap in something like,
$(document).ready(function()
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
);
the element you're trying to append to may not have loaded yet
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55067315%2finserting-a-div-into-another-static-div-for-mobile%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$( document ).ready(function()
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
);
By default, JavaScript doesn't know when to execute: you have to tell it when. This example will execute on $(document).ready()
which means when the page is done loading.
add a comment |
$( document ).ready(function()
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
);
By default, JavaScript doesn't know when to execute: you have to tell it when. This example will execute on $(document).ready()
which means when the page is done loading.
add a comment |
$( document ).ready(function()
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
);
By default, JavaScript doesn't know when to execute: you have to tell it when. This example will execute on $(document).ready()
which means when the page is done loading.
$( document ).ready(function()
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
);
By default, JavaScript doesn't know when to execute: you have to tell it when. This example will execute on $(document).ready()
which means when the page is done loading.
answered Mar 8 at 16:42
dmanexedmanexe
48241034
48241034
add a comment |
add a comment |
Perhaps you need to wrap in something like,
$(document).ready(function()
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
);
the element you're trying to append to may not have loaded yet
add a comment |
Perhaps you need to wrap in something like,
$(document).ready(function()
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
);
the element you're trying to append to may not have loaded yet
add a comment |
Perhaps you need to wrap in something like,
$(document).ready(function()
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
);
the element you're trying to append to may not have loaded yet
Perhaps you need to wrap in something like,
$(document).ready(function()
$(".headerMobileDiv").append("<div class='container'> Sample Text </div>");
);
the element you're trying to append to may not have loaded yet
edited Mar 8 at 16:43
Zoe
13.6k85486
13.6k85486
answered Mar 8 at 16:42
digital-pollutiondigital-pollution
74449
74449
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55067315%2finserting-a-div-into-another-static-div-for-mobile%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It sounds like you need to put your code in a document.ready event handler, or execute it just before the
</body>
tag– Rory McCrossan
Mar 8 at 16:36
Is there any error in the console on your mobile device?
– Ferrybig
Mar 8 at 16:40