简体   繁体   中英

jquery function call strange behaviour

i'm trying to learn the basics of web site construction. Currently i'm working on a html file hosted on wamp, using jquery/xml/php files. I have run into something very weird calling a simple function:

function showFreq(){
$('#freqD').html("Page refreshes every " + FREQ/1000 + " seconds.");}

Without calling this function, page loads properly (tab formatting, php, xml etc). When i call this function inside $(document).ready(function(){ the page shows up as if there are no scripts. However, if i replace the function call with the command inside it everything works as it is supposed to...

    $('#freqD').html("Page refreshes every " + FREQ/1000 + " seconds.");
///showFreq();

Needless to say that #freqD is a small div element at the bottom of the page containing nothing else in it. It annoys me too much to let it go.

Do you mean that you tried this ?

function showFreq(){
  $('#freqD').html("Page refreshes every " + FREQ/1000 + " seconds.");
}

$(function() {
  showFreq();
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM