Norbert94
Norbert94

Reputation: 173

Dojo Toolkit - compare two strings

I am working on a older project that uses the framework: Dojo Toolkit. I have a jsp-file with the following code:

dojo.style(dojo.byId('nameContainer'), 'display', 'none');

I am getting the id of the element in my DOM and setting the css-style to display:none. Now I want to do set it dynamically based on a request-parameter. Something like this:

if (request.getAttribute("testAttributes").get("newName") === "test"){
           dojo.style(dojo.byId('nameContainer'), 'display', '');
     } else {
           dojo.style(dojo.byId('nameContainer'), 'display', 'none');
           }

I debugged the code and I am getting the attributeValue correctly, however I don't know how to compare two Strings in DOJO. I have tried several ways and cannot find anything useful in the documentation. The code above doesnt do anything..the debuggers jumps in the if-condition and the else-condition

Upvotes: 1

Views: 237

Answers (1)

bajji
bajji

Reputation: 1291

dojo.style(dojo.byId('nameContainer'), 'display', '');

Is there any reason for using '' for display? Take a look at this simple jsfiddle :

Fiddle

Upvotes: 1

Related Questions