문제

My if(str == seltext) is returning true, all the time.

heres my code:-

[% FOREACH cll = classifications %]
    var str = "[% cll.object.name FILTER js %]";
    var seltext = classSel.options[classInd].text;
    alert(str+" "+seltext);
    if(str == seltext)
    {
        alert("classfound=[% cll %]");     /// THIS ALWAYS GETS FIRED
    }
[% END %]

I cannot understand why this is happening, I think it might be because the [% only gets saved the the variable str once, but they my alert wouldn't change.

도움이 되었습니까?

해결책

The way i fixed this was by revering the if statement so it goes like this

if(classSel.options[classInd].text == "[% cll.object.name FILTER js %]")

then it works

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top