0

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

3
  • 1
    Do you need something like this jsfiddle.net/o93f3za6/4 or this jsfiddle.net/o93f3za6/5 ?? Commented Apr 5, 2016 at 6:27
  • 1
    You cannot customize default checkbox. To do, refer this Commented Apr 5, 2016 at 6:28
  • i appreciate you answer and i know its works that way , is it my code version is old or deprecated ? Commented Apr 5, 2016 at 6:34

2 Answers 2

1

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/

Sign up to request clarification or add additional context in comments.

2 Comments

thanks man that worked. border is the problem and its worked with outline.
Glad I could help :)
0

try this

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

https://jsfiddle.net

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.