Skip to content
Advertisement

How to change font color on an ajax button? Php and Yii 1.1

I have a small question some of you might help me with instantly.

I am currently working on a website where all the buttons need to be the same color. However, through some dumb reasons (lack of Skill in my case) I have created an ajaxButton and now need to change the text color of said button to orange.

Unfortunately, I have no idea how to do this and thought some of you might help me with my little dilemma. I have no css skills whatsoever and though that there must be a method where I can directly change said color as I desire.

echo CHtml::ajaxButton('Create',
    Yii::app()->createUrl("path/to/action/create"),
    array(
        'type'=>'POST',
            'dataType'=>'json',
            'url'=>'js:$(this).attr("href")',
            'success'=>'js:function(html) {
                jQuery("#myModal .modal-content").html(html.view);
                $("#myModal").modal();
            }',
        'buttons'=>array(
            'update'=>array(
                'options'=>array(
                    'title'=>'Create Something',
            'cache'=>false,
        ),
        array('data-toggle'=>'modal', 'data-target'=>'#myModal'),
                )
            )
        )
    )

So this would be the button that needs a new text color. I really hope you can help me with this. Thanks for your time everyone.

Advertisement

Answer

In order create css class then use ajax to add after success like:
CSS

<style>
.color{
color:orange;
}
</style>

JS:

'success'=>'js:function(html) {
                jQuery("#myModal .modal-content").html(html.view);
                $("#myModal").modal();
                $("#Button").addClass("color");
            }',
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement