SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2012
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    add disable attribute on to all elements

    Does anyone know how to add "disable attribute" to all elements when button is clicked?

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,312
    Mentioned
    178 Post(s)
    Tagged
    8 Thread(s)
    Hi there,

    Please define "all elements".

    The following snippet will disable all inputs on a page on button press (where the button has an id of "myButton")

    Code JavaScript:
    $("#myButton").on("click", function(){
      $("input").prop('disabled', true);
    });


Bookmarks

Posting Permissions

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