Im trying to add the link below to open in a new windows using showSPDialog

 newRows +="<p><span><a onclick='/showSPDialog(\' + viewurl + \');/'  href='#'><img src='/Test/SiteAssets/sendmail.png'/  title=" + email + "></a></span></p>";
                        newRows +="</li>";

But i keep getting error ; missing character bla bla..

No idea what im missing . Any help will be appreciated.


updated code below:

 newRows +="<p><span><a href='#' onclick='showSPDialog(" + viewurl + ");'>MS SharePoint Site</a></span></p>";

But getting error missing ) after argument list - error on the :


  • What are the forward slashes for? Wouldn't that just make the attribute values into regular expressions? – eirikb Nov 17 '14 at 6:34
  • sorry pasted the wrong one: See my update in the Original Post – naijacoder Nov 18 '14 at 0:35
  • If viewurl is a string, and not the name of a variable your code will not work. The end result would be something like calling showSPDialog(http://google.com), which will not work very well. It will work if you have something like var viewurl = '"http://google.com"';. But wouldn't it be better to use some sort of templating? – eirikb Nov 18 '14 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.