0

Hello, I have a script which is as follows (not written by me), and would like to get the value of "content" in this case to be displayed on the screen for test purposes, how can I do this?

<script type="text/javascript">
        $(document).ready(function (){          
            var content = $('#menu-upper').html();          
            $('#menu-upper').html('');
            $('#menu-lower').html(content);
        });
</script>
2
Contributors
4
Replies
20
Views
4 Years
Discussion Span
Last Post by Ritesh_4
0

Hello, I have a script which is as follows (not written by me), and would like to get the value of "content" in this case to be displayed on the screen for test purposes, how can I do this?

Where did you get this code? I mean I hope you know that what you mention doesn't make sense:

get the value of "content" in this case to be displayed on the screen for test purposes

<script type="text/javascript">
$(document).ready(function (){
var content = $('#menu-upper').html();
$('#menu-upper').html('');
$('#menu-lower').html(content);
});
</script>

Can you explain to me what is #menu-upper and #menu-lower? I assume it is some sort of div container.

So you just want to display data from the tags?

You can try this (your javascript code is this):

<script type="text/javascript">
$(document).ready(function (){
var content = "This is where you data is display";
$('.menu-upper').html(content);
});
</script>

This is the output:

<div class="menu-upper"></div>

Edited by LastMitch: grammer

0

i got the code from an old version of a custom-made cms (made by the same person who wrote this code but not present now)

In fact I wanted to know the values being stored in the "content" variable, so that I can remove specific items to for use from it. Yes the menu-upper and lower are div containers having these IDs

0

n fact I wanted to know the values being stored in the "content" variable, so that I can remove specific items to for use from it. Yes the menu-upper and lower are div containers having these IDs

I don't know what you are trying to do?

I hope you don't expect someone to debug the code for you.

Since you want to know the content of #menu-upper and #menu-lower

Try this:

<script type="text/javascript">
$(document).ready(function (){
var content = "This is where you data is display";
$('.menu-upper').html(content);
var contents = "This is where you data2 is display";
$('.menu-lower').html(content);
});
</script>

This is the output once you run the code and this is how it looks like:

<div class="menu-upper">This is where you data is display</div>
<div class="menu-lower">This is where you data2 is display</div>
0

thanks, am somewhat getting to know some more about javascript/jquery syntax, never used them in the past, still learning the ropes...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.