Forum Moderators: open
function validate(Example) {
var isGood = true;
//validate test
if(document.getElementById('test').value=='')
{
isGood = false;
} //return true or false
if (isGood== false)
{
alert (isGood);
}
return isGood;
}
$(function() {
$('#addquestion').click(function() {
$('<input id="test" type="text" name="text1" /><br />').appendTo('#to_moreoptions');
if(document.getElementById('formid').value=='vrednost')
{
validate('test');
}
});
});
function validate(Example) {
var isGood = true;
alert(Example);
}
$(function() {
//if I put validate('test') here, it will alert test
if(document.getElementById('formid').value=='vrednost')
{
validate('test');
}
});