Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to make alert message on select the radio button using Javscript

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 203
    Comment on it

    Hello Reader's! If you want to make an alert message for everytime user select the button then you can use the following JS as below:-

    Lets say our HTML is like this:-

    <input class="gender" type="radio" name="sex" value="male">Male <br> <input class="gender" type="radio" name="sex" value="female">Female
    

    Then the JS will go like this:-

    $(document).ready(function () {
    $(".gender").change(function () {
    
        var val = $('.gender:checked').val();
        alert(val);
    });
    });
    

    Output:- Now when user select male or female an alert box will open

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: