Recently I was working with dynamic controls where I got in to a small issue where I need to provide parameters in JavaScript function. I tried lots of things , But here is the approach which solved my issue:
Example:
sb.AppendLine(@"<li><a href='#' onclick='FunctionTest(" + "\"" + string1 + "\" ,\"" + string2+ "\"," + int1 + ")'>" + string4 + "</a></li>");
Explanation:
We can divide above code in following parts:
1) sb.AppendLine(@"<li><a href='#' onclick='FunctionTest(" completes first string
2) + "\"" + string1 + "\" Adds " string1 " (string parameter) to function
3) " + int1 + " Adds int1 (integer parameter) to function
4) )'>" + string4 + "</a></li>"); Complete remaining string
Subscribe to:
Post Comments (Atom)
The "Mark as Decorative" Feature in SharePoint: A Small Toggle With a Big Accessibility Impact
If you've spent any time building pages in SharePoint Online, you've probably noticed a new checkbox tucked inside the Accessibility...
-
In last blog we learn how can we enable footer on SharePoint Online Modern Communication site. If you have not gone through that you can use...
-
Code Review :- General 1. Remove the commented code 2. Variable name should not be contain "_". 3. Query should be in separat...
-
In previous blog we have go through the csv creation part. You can find it on below link: File Server Migration To SharePoint Online using S...
No comments:
Post a Comment