Style a dojo button

1333
7
12-20-2017 02:04 PM
BrandonPrice
Occasional Contributor

Hello,

I would like to make a few small css changes to some buttons on my splash pages. 

var myButton1= new Button({
label: "I Accept",
onClick: function(){
splashPage2.show();
splashPage1.hide();
domStyle.set(splashPage2.closeButtonNode, { display: 'none' });
domStyle.set("myButton1", {fontSize:"5pt",letterSpacing:"1.2em"});
}
}).placeAt(splashPage1.containerNode);

The part in bold does not change the style. Any suggestions to get the changes to work are appreciated. I stopped searching reference material online at the moment.

https://community.esri.com/groups/web-appbuilder-custom-themes?sr=search&searchId=2867be5a-d1d5-477d...

https://community.esri.com/groups/web-app-builder-custom-widgets?sr=search&searchId=ec038c3c-7cc7-4a...

Tags (4)
0 Kudos
7 Replies
RobertScheitlin__GISP
MVP Emeritus

Brandon,

   Remove the double quotes from myButton1 so that you are passing the button and not an id of the button like you have now (thought your button does not have that or any id).

BrandonPrice
Occasional Contributor

Oh yeah. Thanks. You are right. I still cannot get it to work:

var myButton1= new Button({
label: "I Accept",
onClick: function(){
splashPage2.show();
splashPage1.hide();
domStyle.set(splashPage2.closeButtonNode, { display: 'none' });
domStyle.set(myButton1, "width", "100px");
}
}).placeAt(splashPage1.containerNode);

it might need an id to be changed because maybe it will automatically override my script and just inherit the default dojo style

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Brandon,

   That is likely the case. So the better route is to add a class to the button and add a css rule to the widgets css/style.css file.

BrandonPrice
Occasional Contributor

That's what I thought after doing some research. I will get back to it later and repost. It isn't urgent of when it's fixed.

0 Kudos
BrandonPrice
Occasional Contributor

an urgent fix*

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

What have you tried?

0 Kudos
BrandonPrice
Occasional Contributor
I was going to try something like this when I get the chance:

dojo.create("button",{id: "btnOK",type: "button"},dojo.body());     var btnOK = new dijit.form.Button({                label: "OK",                showLabel: true,                style: "height: 20px;"                },               "btnOK");     dojo.style("btnOK","width","40px");

Brandon
0 Kudos