Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Aug 2012
    Posts
    123
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Show image without border

    Can anyone help me a javascript how to show an image without border when mouse click on its link?

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,639
    Thanks
    0
    Thanked 649 Times in 639 Posts
    In your CSS put

    a img {border:0;}

    This doesn't require any JavaScript to get rid of the border.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    New Coder
    Join Date
    Jul 2013
    Posts
    48
    Thanks
    0
    Thanked 2 Times in 2 Posts
    $("img").error(function () {
    $(this).css("border", "none");
    });



    use this code

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,639
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Quote Originally Posted by john88 View Post
    $("img").error(function () {
    $(this).css("border", "none");
    });



    use this code
    Don't use that code - having the entire JQuery library and the above calls to it in the page is overkill compared to a single CSS statement.

    The above JQuery solution is about 3000 times longer than the CSS one plus it will not work for as many of your visitors as the shorter solution will.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    New Coder
    Join Date
    Jul 2013
    Posts
    48
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by felgall View Post
    Don't use that code - having the entire JQuery library and the above calls to it in the page is overkill compared to a single CSS statement.

    The above JQuery solution is about 3000 times longer than the CSS one plus it will not work for as many of your visitors as the shorter solution will.
    summed up like a professional

    its just that this was the first thing that came to my mind


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •