Posts

Showing posts with the label prop()

Difference b/w attr() and prop() in Jquery.

Sometimes we confused, which function should we use between prop(); and attr(); function. we can understand it by the following example==> HTML==> <div class="container">     <div id="div1"> </div>     <div id="div2"> </div>     <div id="div3"> </div>      <div id="div4"> </div>     </br>     <input type="text"  id="textId" name="input1" readonly="readonly"  autocomplete="autocomplete"  autofocus  />   </div> JQuery==> <script type="text/javascript">     $(document).ready(function(){       $("#div1").html($("#textId").attr("name")+'</br>');       $("#div2").html($("#textId").prop('readonly')+'</br>')          $("#div3").html($("#textId").attr('readonly')+...