tags:

views:

108

answers:

1

Hi, I have a dropdown box with three values,small,medium and large.If the value is small, the text created should be 100px,if medium then 200px if large,400px. Based on this value can I save the size in a variable,and use that variable in the style attribute?

For eg, I get the value of the drop down box as

fieldsize=$('#fieldSize').fieldValue();

Can i code, if(fieldsize=="small"){size=100;} and use that size variable in the style attribute? (style= 'width:size px')

if(fieldType=="text"){
$("<input id=inputstr"+increment+" type= 'text' style= 'width:100px'></input><br><br>").appendTo("#fb_contentarea_col1down21");
}
+1  A: 

Just do a switch statement to check the value of fieldSize small = "100px" medium = "200px" large = "400px"

Then in your append code write $("<input style='width:"+fieldWidth+";' ... >")

peirix