i want to design a dynamic modal-dialog for my component. i get width and height from input and set these to my content div. and may be i have several modal-dialog in one page. how can make it with java script and jQuery ?
Asked
Active
Viewed 126 times
0
-
Probably duplicate of http://stackoverflow.com/q/5753680/1926369 – vals Dec 26 '13 at 08:39
2 Answers
2
You can try to use
as in $( "#mydiv" ).css( "color", "green" )
You can use it with any jquery selector/id, not just class.
$( "#mydiv [name='changeme']" ).css( "color", "green" );

Scary Wombat
- 44,617
- 6
- 35
- 64
-
thank you but i have a problem when i use .css() ,this method change my classوWhereas i want use this class for another div. – Abbas Rahimi Dec 26 '13 at 08:29
-
-
NO ,i think you do'nt got my Purpose.this method change my content class but i want use this class for other similar div.and my div was changed. – Abbas Rahimi Dec 26 '13 at 08:36
-
-
i have a class in my css file.i must change width and height of this class just for one time ,and i want to reset my class for Reuse. – Abbas Rahimi Dec 26 '13 at 08:46
-
So is there any way to unique identify the DIV you want to change? If so you can use the above method and a jquery selector to uniquely change it. e.g. `$( "#mydiv [name="changeme"]" ).css( "color", "green" );` – Scary Wombat Dec 26 '13 at 08:49
1
Use as follows :
$( "#mydiv" ).css( "width", $("#widthtextbox').val() );
And
$( "#mydiv" ).css( "height", $("#heighttextbox').val() );
Where widthtextbox and heighttextbox and the ids of the textbox from where you are trying to use values, and mydiv is the div to add css to.
hope this helps you.

Sunil Verma
- 2,490
- 1
- 14
- 15