jQuery

Check If Element Has ID Using jQuery

To check if an element has an ID: if ($(this).is('[id]') { // Has ID console.log('Has ID: ' + $(this).attr('id')); } else { // Has no ID console.log('Has no ID.'); }

2019-02-11T22:30:07-04:00February 11, 2019|

jQuery – Selector Starts-Ends With

Selector Starts With: $('input[name^=somePrefix]').doSomething(); Selector ENDS with: $('input[name$=someSuffix]').doSomething(); In ASP.Net: This is particularly useful in ASP.Net when you may not want to specify clientidmode static, but still want to use [...]

2019-02-06T23:56:27-04:00August 6, 2018|Tags: , |

jQuery – Get Ajax Post Error Details

$.post('status.ajax.php', {deviceId: id}) .done( function(msg) { ... } ) .fail( function(xhr, textStatus, errorThrown) { alert(xhr.responseText); }); http://stackoverflow.com/a/12116790/4669143

2019-02-06T23:57:31-04:00August 6, 2018|Tags: |

jQuery – Enable or Disable Inputs

$("input").prop('disabled', true); $("input").prop('disabled', false); This will automatically add/remove the 'disabled' property of the element. Source: http://stackoverflow.com/a/1414366/4669143

2019-02-06T23:58:43-04:00August 6, 2018|Tags: |
Go to Top