I feel like an idiot, but I'm going to ask anyway because I am going crazy.
I have an image element on the page that I need to dynamically change the padding on based on a users selection. The only way to do so it to amend the style tag that is on this image since there could be multiple of the page.
To do so I am grabbing the image and then adding a .css()
to it.
var currentImg = $(this.$el.find('.form_control').find('img'));
var imagePadding = props ? JSON.parse(props)['ImagePadding']: '';
and then
$(currentImg ).css("padding", imagePadding+'!important');
Seems simple. But it's not applying the css to the element.
The image is coming back looking like this
[<img class="mCS_img_loaded" src="img/kiosk/placeholder.jpg" style="font-family: Helvetica; border: 1px solid rgb(0, 65, 120); color: rgb(255, 255, 255); font-size: 1.25em; background-color: rgb(0, 93, 171);">]
My first thought was because it is coming back in an array (with the []) and tried to drill down using a [0]
however that just threw type errors. So I am at a loss. I do not have any other padding styles coming back on it.