質問

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