javascript - Jscript + jquery + an example of basic difference -


i new learning js , better understanding of concept, apologies in advance ignorance or simplicity of question. trying build simple quiz game learn javascript.

basically trying understand difference between these 2 versions:

javascript example

jquery example

basically trying understand difference in these 2 lines:

javascript

document.getelementbyid("question").innerhtml = "<b>question " + questionindex +"</b>: " + allquestions[0][questionindex-1]; 

jquery

$("#question").text("<b>question " + questionindex +"</b>: " + allquestions[0][questionindex-1])  

the javascript version display "question x:" in bold won't in jquery version. why? , how make jquery version bold part work? or other advice in general on this?

tks

.text() sets text, not html. use .html() instead:

$("#question").html("<b>question " + questionindex +"</b>: " + allquestions[0][questionindex-1])  

also, jscript isn't javascript. mean javascript.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -