javascript - variable value is not appending in h2 element -
demo
hi, have variable called "var node = "hi mr", iam trying append value on click of button, im not sure why not appending. tried using html , text, none worked.
js:
$(function(){ $('.customerresultindex').on('click',function(){ opencustomeroverlay(); }) }); function opencustomeroverlay(){ var node = "hi mr" $('.customerpopheading').text(node) var overlaycontainer = '<div class="customeroverlayshadow">'+ '<div class="customeroverlay borderradius10px">'+ '<h2 class="customerpopheading">-- </h2>'+
create element first, them after this, set text... setting text befero creating it.
put this:
var node = "hi mr"; $('.customerpopheading').text(node);
after this:
$(document).keyup(function(e) { if (e.keycode == 27) { $('.customeroverlayshadow').remove(); } });
final result: http://jsfiddle.net/pc2tx1us/3/
javascript jquery popup overlay
No comments:
Post a Comment