PDA

View Full Version : Inserting a variable within an append function in JQuery?



denhamd2
09-19-2008, 03:05 PM
Hi,

I have a Javascript variable name called "mouse" which has a string of text stored in it. I am also appending some HTML code to my exisiting HTML using JQuery:




var mouse = "Phone number";

$(document).ready(function(){
$('div.mynav').append("<div id='mine'>MY MOUSE VARIABLE HERE</div>");
});

How do I insert my variable apple where it says "MY MOUSE VARIABLE HERE"?

Thanks in advance

rangana
09-20-2008, 02:36 AM
var mouse = "Phone number";

$(document).ready(function()
{
$('div.mynav').append("<div id='mine'>"+mouse+"</div>");
});