I have a small javascript item that when a dropdownn is selected the contents of a DIV is changed depending on what item is picked.
I would like the chosen DIVs to feature Content Items - so far I;ve got the following JS:
<script type="text/javascript"> function change() { switch (document.getElementById("select").value) { case "1": document.getElementById("change").innerHTML = '<umbraco:Item field="title1" runat="server"></umbraco:Item>' break; case "2": document.getElementById("change").innerHTML = "<umbraco:Item field="title2" runat="server"></umbraco:Item>"; break;
</script>
This works perfectly when it's just html text but doesn't display anything when the content items are added - am I doing something wrong? Any help will be great appreciated.
Adding content items to javascript
Hi Folks,
Apologies if this has been asked before.
I have a small javascript item that when a dropdownn is selected the contents of a DIV is changed depending on what item is picked.
I would like the chosen DIVs to feature Content Items - so far I;ve got the following JS:
<script type="text/javascript">
function change()
{
switch (document.getElementById("select").value)
{
case "1":
document.getElementById("change").innerHTML = '<umbraco:Item field="title1" runat="server"></umbraco:Item>'
break;
case "2":
document.getElementById("change").innerHTML = "<umbraco:Item field="title2" runat="server"></umbraco:Item>";
break;
</script>
This works perfectly when it's just html text but doesn't display anything when the content items are added - am I doing something wrong? Any help will be great appreciated.
Thanks in advance
Darren
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.