user891193
user891193

Reputation:

how to style checkbox using jquery?

I am styling check-box in HTML using Jquery, but its not appearing in the browser . when i checked the browser element property it is showing the style has applied to the element but its not showing in the browser . This is my Jquery code

$("form :checkbox:checked").css("border", "3px solid green");

I am using jquery version 2.2.2, I have checked 1.9.1,1.10,1.12 all are failing and I am using Firefox version 45 and chrome version 49.x . here is the Jsfiddle version of this code source code in jsfiddle

Upvotes: 0

Views: 176

Answers (2)

B.P
B.P

Reputation: 171

try this

$( "form input:checkbox:checked" )
  .wrap( "<span></span>" )
  .parent()
  .css({
    border: "3px red solid"
  });

https://jsfiddle.net

Upvotes: 0

user5563910
user5563910

Reputation:

Try using outline instead of border, like this:

$("document").ready(function(){
  $('form input:checkbox:checked').css("outline", "3px solid red");
})

fiddle: https://jsfiddle.net/rdawkins/36ccvk4h/7/

Upvotes: 1

Related Questions