Copy text: cannot find my syntax error
I want to conditionally copy the text to a popup, however if I use a var, it works; if I use the selector, it does not work. In the example below, the var textVal works, but the selector,
"div#text1" does not work. Probably been looking at it too long!
Todd
- $(document).ready(function(){
- $("li a").click(function() {
- var popupName = $(this).attr("id");
- var textVal = $("div#text1").html();
- //alert(popupName);
- //alert(textVal);
- if (popupName == "showPopup1") {
- // This does work
- $(textVal).insertAfter("div#popupText").html();
- // This does not work
- //$("div#text1").insertAfter("div#popupText").html();
- } else if (popupName == "showPopup2") {
- $("div#text2").insertAfter("div#popupText");
- }
-
- $("#middleLayer").toggle();
- $("#popup").toggle();
- });
- });