Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

validating value from a input text field

$
0
0

Hi I'm new to the Edge Animate and I have been working on a project that requires text input. The code does not 'recognise' the value entered into the input field. The action is quite straight forward, Correct Answer (360) play label 02, Wrong Answer play label 03. Ideally I would like allow three attempts.  I don't have much experience in JavaScript, this piece of code are bits and pieces that I have put together from tutorial and a bit of help.  Thank you and I appreciate all the help!

 

 

 

var answer = sym.$("answer");

answer.html("Answer 1");

inputAnswer = $('<input />').attr({'type':'text', 'value':'', 'id':'answer'});

inputAnswer .css ('font-size', 14);

inputAnswer .css ('width', 150);

inputAnswer .css ('background-color','#ffffff');

inputAnswer .appendTo(answer);

 

var submitBtn = sym.$("btn");

 

function checkAnswer(){

 

var rightAnswer = inputAnswer.attr('value');

 

if (rightAnswer == "360")

          {

sym.play("02");

          }

  else

          {

sym.play("03");

          }

          return false;

}

 

 

submitBtn.click(function(){

         checkAnswer();

});

 

 

q.jpg


Viewing all articles
Browse latest Browse all 9897

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>