jQuery的不工作,以改变内部的HTML? [英] jquery not working to change inner html?
本文介绍了jQuery的不工作,以改变内部的HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿,我刚接触jquery的人,在过去的几个小时里,我一直在努力解决这个问题……在这里,我到底怎么了?我要做的就是更改div的innerHTML.
hey people I'm new at jquery and i have been trying to figure this out for like the past couple of hours... what the hell am I doing wrong here? All I want to do is change the innerHTML of a div.
$("left_menu_bar").innerHTML = "You clicked me!";
但是当我使用该代码init调用该函数时,div根本没有改变.
but the div doesn't change at all when I call the function with that code init.
推荐答案
这样做:
// referencing by id
$("#left_menu_bar").html("You clicked me!");
// referencing by class name ( will apply to all div's with this class )
$(".left_menu_bar").html("You clicked me!");
这篇关于jQuery的不工作,以改变内部的HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文