You need to sign in to do that
Don't have an account?
MMA_FORCE
Place apex VF Tags outside of javascript????
How would I place my datatable tags outside the javascript tags and just have the outputtext value appear...???
<script type="text/javascript"> $(document).ready(function(){ j$("input#e").myfun({ source: ['<apex:dataTable value="{!Teach}" var="t"> <apex:outputText value="{!t.skc__Teacher__r.Name}"/></apex:dataTable>'] }); }); </script>
The other thing you could do is wrap your datatable inside of a div like so:
<div id="theDataTable" style="display:none"> '<apex:dataTable value="{!Teach}" var="t"> <apex:outputText value="{!t.skc__Teacher__r.Name}"/></apex:dataTable> </div>
And then in your JS:
<script type="text/javascript"> $(document).ready(function(){ j$("input#e").myfun({ source: [ $("theDataTable").innerHTML ] }); }); </script>
All Answers
I don't think you can directly do exactly what you want here. VisualForce tags generate HTML, not just values. So that dataTable tag will, among other things, generate a <table> tag, and the outputText will generate a <span> surrounding its values.
You could get a bit closer (stripping out the table tags and other table stuff) by using <apex:repeat> tag instead of an <apex:dataTable>. But you'll still have to strip out the generated <span> and </span> tags yourself. Probably the safest way to do this is using JavaScript regular expressions (in case there are any additional attributes or whitespace in the span tags), as described here:
http://www.regular-expressions.info/javascript.html
The other thing you could do is wrap your datatable inside of a div like so:
<div id="theDataTable" style="display:none"> '<apex:dataTable value="{!Teach}" var="t"> <apex:outputText value="{!t.skc__Teacher__r.Name}"/></apex:dataTable> </div>
And then in your JS:
<script type="text/javascript"> $(document).ready(function(){ j$("input#e").myfun({ source: [ $("theDataTable").innerHTML ] }); }); </script>