html - Can't get jquery ui modal dialog to show input form -
i have web page on displayed thai phrases english counterparts. when icon alongside english text clicked, modal dialog displayed , english obscured. want dialog show input box user enter english text. on closing dialog, english made visible again. here code:
jquery(document).ready(function() { var englishtextid; var t2e_dlog = jquery("div#t2e_dialog").dialog({ autoopen: false, modal: true, position: "center", resizable: false, draggable: false, dialogclass: "t2e_dlog", height: 140, width: 400, create: function() { jquery(this).parents(".ui-dialog") .css("border", "solid black 1px") .css("background", "#ffffe8") .css("border-radius", "3px") .find(".ui-dialog-content") .css("font-family", "verdana") .css("font-size", "0.65em") .css("font-style", "normal") .css("color", "#1901b2") .css("padding", "5px 1px") .find(".ui-dialog-header") .css("display","none"); } }); jquery("span.t2e_icon").on("click", function(evnt) { t2e_dlog.dialog("open"); evnt.stoppropagation(); // obscures selected phrase var elementid = evnt.target.id; englishtextid = ("span#t1ee" + elementid.substring(7)); // obscures text in page associated dialog box jquery(englishtextid).css({"border-radius" : "3px","background" : "blue", "color" : "blue"}); }); jquery(function() { // removes dialog box title bar jquery( "#dialog" ).dialog(); jquery("#ui-dialog-title-dialog").hide(); jquery(".ui-dialog-titlebar").removeclass('ui-widget-header'); // placemarker html var input = "<p>please enter english phrase here:</p><p>hello</p>"; jquery("div#t2e_dialog").append(input); }); jquery(function() { jquery("div#t2e_dialog").dialog({ // unobscures text beforeclose: function( event, ui ) { jquery(englishtextid).css({"border-radius" : "3px","background" : "", "color" : ""}); } }); }); });
the above code works indicated html placemarker,
<p>please enter english phrase here:</p>
but if replaced html form,
<form id="t2eform" action="#"><input type="text" id="t2e_w" name="t2ewrite"></form>
the dialog not displayed. i've looked around online can't see relevant. appreciated.
probably input variable have '
, "
mixup, try fix like:
var input = '<form id="t2eform" action="#"><input type="text" id="t2e_w" name="t2ewrite"></form>';
Comments
Post a Comment