Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing the color of a bootstrap button
Message
From
27/12/2016 10:27:07
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
26/12/2016 16:24:19
General information
Forum:
PHP
Category:
Other
Miscellaneous
Thread ID:
01646032
Message ID:
01646113
Views:
33
>>All it takes is an if condition. The problem is there are so many ways of doing this in PHP now. Do you in bead PHP code in the html (the old way) or are you doing this in PHP classes?
>>
>>
>>// in html 
>><input type="button" class="<?php  (some condition) ? 'class1' : 'class2' ?>" value="button name" />
>>
>>
>>Post some code If that doesn't work for you.
>
>Thank you, Jim
>Yes, I'm embedding the PHP code.
>I'll look into classes

If you mean to change style properties of objects at runtime, then jQuery is your friend. Check the .addClass(), .removeClass() (or equivalents thereof, it's been eight years since I was seriously playing with that). And the nice thing about jQuery is the selectors - you pretty much always work with a collection of objects fitting your selector, and you don't care how many of them are found (zero, one, many - just like in caveman's maths), you are still making one function call.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform