Matthew Pickard
Posts: 0
Joined: Wed Jun 25, 2014 4:09 pm

Adjust max-width of the "fieldcontain" of in Input Component

What is the easiest way to adjust max-width of the "fieldcontain" of in Input Component. Ive tried the following in "Run JavaScript" on a page load.:

Appery('userNameInput').css("max-width","300px");

but it's not working with the "fieldcontain" just where the user can input text. Any ideas?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Adjust max-width of the "fieldcontain" of in Input Component

Hi Matthew,

Use the following code please:preApperyio('userNameInput').parents().find("data-role=fieldcontain").css("max-width","300px");/pre

Matthew Pickard
Posts: 0
Joined: Wed Jun 25, 2014 4:09 pm

Adjust max-width of the "fieldcontain" of in Input Component

This is the error I get in the console:

"Uncaught Error: Syntax error, unrecognized expression: data-role=fieldcontain"

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Adjust max-width of the "fieldcontain" of in Input Component

Hi Matthew,

I'm sorry, mistyped :(
Should be the following:preApperyio('userNameInput').parents().find("[data-role=fieldcontain]").css("max-width","300px");/pre

Matthew Pickard
Posts: 0
Joined: Wed Jun 25, 2014 4:09 pm

Adjust max-width of the "fieldcontain" of in Input Component

Perfect, now just to get it to always be center I tried:

Apperyio('userNameInput').parents().find("[data-role=fieldcontain]").css("align","center");

but that is not working. I even tried the simplified version:

Appery('userNameInput').css("align","center");

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Adjust max-width of the "fieldcontain" of in Input Component

Hi Matthew,

Please use following code:

pre

//Note you should replace 'mobiletextinput_42' with your input component name.
Apperyio('mobiletextinput_42').parents().find("[data-role=fieldcontain]").css({
"max-width": "300px",
"margin-left": "auto",
"margin-right": "auto"
});

/pre

Regards.

Return to “Issues”