Renaud is Not Bill Gates
Renaud is Not Bill Gates

Reputation: 2074

success function in ajax doesn't work

I have an ajax function and I want on success to change CSS for some HTML elements, in the success I did :

success:function(d){
        $('#name').css('weight','normal');
        $('#msg').css('weight','normal');
        $('#date').css('weight','normal');
}

But It won't work.

When I do this :

success:function(d){
        alert('some thing');
}

It worked.

so I think the problem is from the code I used in the success function.

Upvotes: 0

Views: 104

Answers (3)

Premshankar Tiwari
Premshankar Tiwari

Reputation: 3106

font-weight is the correct property name.... Also you can mention all selectors in single line since operation is same..

Use this code...

$('#name, #msg, #date').css('font-weight','normal');  

Upvotes: 0

Milind Anantwar
Milind Anantwar

Reputation: 82231

It should be:

success:function(d){
    $('#name').css('font-weight','normal');
    $('#msg').css('font-weight','normal');
    $('#date').css('font-weight','normal');
 }

Upvotes: 1

moonwave99
moonwave99

Reputation: 22817

There is no weight CSS property, try with font-weight.

Upvotes: 3

Related Questions