2

Uncaught SyntaxError: missing ) after argument list

 $(document).ready(function(){

     $('.rc-anchor-normal .rc-anchor-pt').css('position':'absolute').css('top':'60px').css('right':'35px');
     $('.rc-anchor-logo-img-portrait').css('position':'absolute').css('right':'50px');
     $('.rc-anchor-logo-text').css('position':'absolute').css('right':'50px').css('top':'45px');


    });
cool_benn
  • 56
  • 8

3 Answers3

5

The function css() expects function arguments as comma separated. You are using css('top': '60px'), notice that : there which is incorrect.

$(document).ready(function() {    
  $('.rc-anchor-normal .rc-anchor-pt').css('position', 'absolute').css('top', '60px').css('right', '35px');
  $('.rc-anchor-logo-img-portrait').css('position', 'absolute').css('right', '50px');
  $('.rc-anchor-logo-text').css('position', 'absolute').css('right', '50px').css('top', '45px');    
});

You should also keep habbit of looking at the browser console F12 in chrome to check the errors you get while running the code.

You can also combine the chained css() into a single one using object representation:

$(document).ready(function() {
  $('.rc-anchor-normal .rc-anchor-pt').css({
    'position': 'absolute',
    'top': '60px',
    'right': '35px'
  });
  $('.rc-anchor-logo-img-portrait').css({
    'position': 'absolute',
    'right': '50px'
  })
  $('.rc-anchor-logo-text').css({
    'position': 'absolute',
    'right': '50px',
    'top': '45px'
  });
});
Ankit Agarwal
  • 30,378
  • 5
  • 37
  • 62
0

JQuery's .css() function can accept either 2 params, first is property name, and the second is the value, or one parameter that is of type JSON, which you tried to add but forgot curly braces { }, so try this:

$(document).ready(function(){

   $('.rc-anchor-normal .rc-anchor-pt').css('position':'absolute').css({'top':'60px'}).css({'right':'35px'});
   $('.rc-anchor-logo-img-portrait').css({'position':'absolute'}).css({'right':'50px'});
   $('.rc-anchor-logo-text').css('position':'absolute').css({'right':'50px'}).css({'top':'45px'});

});
AwesomeGuy
  • 1,059
  • 9
  • 28
0

.css function expects argument in a different way. You are passing the arguments in a wrong way. Correct and better way:

$('.rc-anchor-normal .rc-anchor-pt').css({
  'position': 'absolute',
  'top': '60px',
  'right': '35px'
});
$('.rc-anchor-logo-img-portrait').css({
  'position': 'absolute',
  'right': '50px'
});
$('.rc-anchor-logo-text').css({
  'position': 'absolute',
  'right': '50px',
  'top': '45px'
});

Refer: http://api.jquery.com/css/

K K
  • 17,794
  • 4
  • 30
  • 39