开发者

jquery .html not working

I am trying to replace some div text automatically using the .html command in Jquery but it's not working for me. This is the code I have so far:

    <div id="test">123</div>

    <script type="text/javascript">

    jQuery(document).ready(function(){

    var refreshId = setInterval(function()

    {

    $('#test').html("test");

    }, 1000);


});

</script>

Could someone tell me what I'm doing wrong please? I have ran tests to make sure Jquery is working and it is, and if I run alert('test'); then that works fine.

Thanks for any help

Ed开发者_开发知识库it: I have ran the script in another file on localhost and it works fine - could it be something within the code I'm using already that's stopping it from working? This is baffling me!


When I have problems like this it's usually due to some javascript/jquery prior to this part which is incorrect.

If you can, try proofing or commenting out some other parts of your code to see if you can make it work.


In your full page code, is it possible that you have one more control with the same id? If so, jQuery can select it instead of your div.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜