javascript - jQuery function which fires dialog not being found -
below fiddle attempts fire dialog truncated text when href selected :
<a href='javascript:void(0)' id="truncatedtext" onclick='fnopennormaldialog("this text truncate");return false'></a> $(function(){ $("#truncatedtext").text(truncatetext('truncate text')); }) function truncatetext(text) { var shorttext = jquery.trim(text).substring(0, 20) .split(" ").slice(0, -1).join(" ") + "..."; console.log(shorttext) return shorttext } function fnopennormaldialog(text) { $("#dialog-confirm").html("confirm dialog box"); // define dialog , properties. $("#dialog-confirm").dialog({ resizable: false, modal: true, title: "modal", height: 250, width: 400, buttons: { "yes": function () { $(this).dialog('close'); callback(true); }, "no": function () { $(this).dialog('close'); callback(false); } } }); }
jsfiddle : http://jsfiddle.net/vvjj8/6236/
but function fnopennormaldialog
not being found, chrome error :
uncaught referenceerror: fnopennormaldialog not defined(index):72 onclick
is function not defined correctly ?
i've updated jsfiddle , have added missing div.
your link looks
<a href='#' id="truncatedtext"></a> <div id='dialog-confirm'></div>
Comments
Post a Comment