Cant put linear-gradrient in jquery?

67
December 22, 2018, at 7:10 PM

this inst giving the background to my div. But if i take the linear away it gives the var value to it. Cant i give linear-gradients in jquery?

var border_cor = 'red'; var border_cor2 = 'blue';

$(document).ready(function(){ $('.push_me').css({ 'background': 'linear-gradient(to right,' + border_cor + '50%,' + border_cor2 + ' 50%)'}); })

Answer 1

You're missing spaces between color and percentage.

Fixed example:

var border_cor = 'red'; var border_cor2 = 'blue';
$(document).ready(function(){ 
  $('.push_me').css({ 
    'background': 'linear-gradient(to right,' + border_cor + ' 50%,' + border_cor2 + ' 50%)'}); 
  });
READ ALSO
jQuery table not synchronizing table rows content when summarizing the total

jQuery table not synchronizing table rows content when summarizing the total

I have a table that allows users to search and it will automatically compute the total based on the resultI'm hiding the rows that don't meet the search criteria

20
Sending base64 string in Ajax request from Javascript application gives me 413 error

Sending base64 string in Ajax request from Javascript application gives me 413 error

Working on React-native application and trying to send base64 string in AjaxIt works for some small images, but gives error of 413 (payload is too big, size exceeds) for some large images

62
Unable to grab certain links from dynamic content

Unable to grab certain links from dynamic content

I've written a script in python in combination with selenium to scrape the links of different properties located at the right sided area right next to the map from its landing page

64
Will enqueuing Page specific CSS Files, using Conditional Logic, cause any problems? [on hold]

Will enqueuing Page specific CSS Files, using Conditional Logic, cause any problems? [on hold]

I am working on a website, which currently has a very large CSS File being enqueued as follows:

58