Tagged: jquery enable button by id

jQuery Disable enable Selector Examples 0

jQuery Disable enable Selector Examples

Today, We want to share with you jQuery Disable enable Selector Examples.In this post we will show you Disable or enable an input field with jQuery, hear for How to disable/enable an element with jQuery we will give you demo and example for implement.In this post, we will learn about Disable or Enable Submit Button using jQuery .prop() Method with an example.

jQuery Disable enable Selector Examples

There are the Following The simple About jQuery Disable enable Selector Examples Full Information With Example and source code.

As I will cover this Post with live Working example to develop jquery change class, jquery disable input, so the jQuery enable/disabled Selector for this example is following below.

HTML DOM Input Text disabled/enable Property

To simple jQuery change the disabled elements property We should use the simple jQuery .prop() function.

(jQuery 1.6+)Disable/enable an input with jQuery?

$("input").prop('disabled', true);
$("input").prop('disabled', false);

The jQuery .prop() function doesn’t any exist, but here similar .attr() jQuery function: Set the disabled attribute.

jQuery 1.5 and below

//disable
$("input").attr('disabled','disabled');

//enable
$("input").removeAttr('disabled');

In any version of jQuery

jQuery assuming an event similar handler function of ‘this’

this.disabled = true;

Example: jquery disable/enable input

The prop() jQuery method need to version of the jQuery 1.6 and above for jQuery Disable/enable an element Examples.

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>Disable or Enable an Input field using jQuery Examples - Pakainfo.com</title>
    <style type="text/css">
        label {
            display: block;
            margin: 8px 0;
        }
    </style>
    <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $('form input[type="submit"]').prop("disabled", true);
            $(".mst_member").click(function(){
                if($(this).prop("checked") == true){
                    $('form input[type="submit"]').prop("disabled", false);
                }
                else if($(this).prop("checked") == false){
                    $('form input[type="submit"]').prop("disabled", true);
                }
            });
        });
    </script>
    </head>
    <body>
	<h2>Disable or enable an input field with jQuery</h2>
        <form>
            <label>Member Name: <input type="text" name="membername"></label>
            <label>Member Email: <input type="email" name="memberemail"></label>
            <label><input type="checkbox" class="mst_member"> You are available for read my website Pakainfo.com?.</label>
            <input type="submit" value="Submit">
        </form>
    </body>
    </html>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about jQuery Disable enable Selector Examples.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

jQuery Enable Disable Submit Button Example 0

jQuery Enable Disable Submit Button Example

Today, We want to share with you jQuery Enable Disable Submit Button Example.In this post we will show you How to enable and disable submit button using jQuery, hear for jQuery – How to disabled submit button after clicked we will give you demo and example for implement.In this post, we will learn about Disable or Enable Submit Button using jQuery .prop() Method with an example.

jQuery Enable Disable Submit Button Example

There are the Following The simple About jQuery Enable Disable Submit Button Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop Enable Disable Submit Button using jQuery, so the some how to enable and disable submit button in php for this example is following below.

Example 1: Enable Or Disable Submit Button Using Jquery

$(document).ready(function() {
     $(':input[type="submit"]').prop('disabled', true);
     $('input[type="text"]').keyup(function() {
        if($(this).val() != '') {
           $(':input[type="submit"]').prop('disabled', false);
        }
     });
 });

Example 2 : Enable Disable Submit Button Based on Validation

<input type="text" name="textTitle" name="suggestion_title" id="suggestion_title" value="" placeholder="Your title" required="" pattern=".{10,100}" maxlength="100" title="Title must be between 10 and 100 characters."/>
<input type="submit" value="send" />

$('input[type="submit"]').attr('disabled', true);
$('input[type="text"]').on('keyup',function() {
    if($(this).val() != '') {
        $('input[type="submit"]').attr('disabled' , false);
    }else{
        $('input[type="submit"]').attr('disabled' , true);
    }
});

Example 3 : enable/disable an element using jQuery

$(function() {
  $(":text").keypress(submitbtn).each(function() {
    submitbtn();
  });
});

function submitbtn() {
  if ($(this).val().length == 0) {
    $(":submit").attr("disabled", true);
  } else {
    $(":submit").removeAttr("disabled");
  }
}

Example 4 : jQuery Disable/Enable button in form

<!DOCTYPE html>
<html>
<head>
<title>Disable a button dynamically created</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
    $('#textTitle').click(function() {
        $(this).prop('disabled',true);

        $("#ckcontent").show();
      
        setTimeout(function(){
           $('#textTitle').prop('disabled', false);
       },4000);
      
     });
});
</script>
</head>
<body>

<div id="btnregister" name="registerbtn">
<p>jQuery disable button — Disabling and enabling buttons with jQuery</p>
    <input type="submit" value="Click me!" id="textTitle" name="textTitle"/>
</div>
  
<div style="display:none;" id="ckcontent">
  The above Clcik button disables for 4 seconds, on clicking.                
</div>

</body>
</html>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about jQuery Enable Disable Submit Button Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.