Use custom function in WP Edit Content and access document form variables
-
Hi friends,
I am editing page content in [Text] tab and want to have custom function inside <script> tag within it to do some calculations on user inputs provided in the <form> objects (like droplist) on that page. Can I access the same in the function? I am unable to do so. Please help me.
<form id=”myform”>
<select name=”Feet” style=”width:4em;”>
<option value=”1″>1 </option>
<option value=”2″>2 </option>
</select>
//================================
<script>
function myfunction()
{
alert(‘hello world’);
$form = document.myform;
$variable1 = $form.Feet.selectedIndex; //This is the line where it fails
}
</script>It fails the above mentioned line ($variable1=$form.Feet.selectIndex;)
with exception=TypeError and error message = “$form1 is undefined”, as I saw in the Inspection debugging section.
The topic ‘Use custom function in WP Edit Content and access document form variables’ is closed to new replies.