Best way to remove an event handler in jQuery?

jQuery ≥ 1.7 With jQuery 1.7 onward the event API has been updated, .bind()/.unbind() are still available for backwards compatibility, but the preferred method is using the on()/off() functions. The below would now be, $(‘#myimage’).click(function() { return false; }); // Adds another click event $(‘#myimage’).off(‘click’); $(‘#myimage’).on(‘click.mynamespace’, function() { /* Do stuff */ }); $(‘#myimage’).off(‘click.mynamespace’); jQuery … Read more

How do I get the value of text input field using JavaScript?

There are various methods to get an input textbox value directly (without wrapping the input element inside a form element): Method 1 document.getElementById(‘textbox_id’).value to get the value of desired box For example document.getElementById(“searchTxt”).value;   Note: Method 2,3,4 and 6 returns a collection of elements, so use [whole_number] to get the desired occurrence. For the first … Read more

Disable/enable an input with jQuery?

jQuery 1.6+ To change the disabled property you should use the .prop() function. $(“input”).prop(‘disabled’, true); $(“input”).prop(‘disabled’, false); jQuery 1.5 and below The .prop() function doesn’t exist, but .attr() does similar: Set the disabled attribute. $(“input”).attr(‘disabled’,’disabled’); To enable again, the proper method is to use .removeAttr() $(“input”).removeAttr(‘disabled’); In any version of jQuery You can always rely … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)