Reputation: 125
I have a string file path that needs to be passed to jquery function this how it looks."3rd parameter on function viewDocument(extension,filename,filepath)
"
<div onclick="viewDocument(doc,APPLICATION FOR POSITION OF HOW2 STUDENT LEADER,/Uploads/2018/Applicant_s219193029/documents/)" class="document info">
<div class="document-body">
<i class="fa fa-file-word-o text-info"></i>
</div>
<div class="document-footer">
<span class="document-name">APPLICATION FOR POSITION OF HOW2 STUDENT LEADER.doc </span> <span class="document-description"> 53KB </span>
</div>
</div>
I have been trying to modify with no luck.
Upvotes: 0
Views: 574
Reputation: 5818
You can wrap them in Single Quotes '
in this case as the onclick function is surrounded with Double Quotes "
onclick= " viewDocument('doc','APPLICATION FOR POSITION OF HOW2 STUDENT LEADER','/Uploads/2018/Applicant_s219193029/documents/') "
Alternatively, with Double Quotes "
if the function is wrapped with Single Quotes '
onclick= ' viewDocument("doc","APPLICATION FOR POSITION OF HOW2 STUDENT LEADER","/Uploads/2018/Applicant_s219193029/documents/") '
function viewDocument(extension,filename,filepath)
{
console.log(filepath);
}
<div onclick="viewDocument('doc','APPLICATION FOR POSITION OF HOW2 STUDENT LEADER','/Uploads/2018/Applicant_s219193029/documents/')" class="document info">
<div class="document-body">
<i class="fa fa-file-word-o text-info"></i>
</div>
<div class="document-footer">
<span class="document-name">APPLICATION FOR POSITION OF HOW2 STUDENT LEADER.doc </span> <span class="document-description"> 53KB </span>
</div>
</div>
Upvotes: 3