When I try to set a text input to blank (when clicked) using $(this).value=\"\", this does not work. I have to use $(this).val(\'\').
Why?
Note that :
typeof $(this) is JQuery object.
and
typeof $(this)[0] is HTMLElement object
then :
if you want to apply .val() on HTMLElement , you can add this extension .
HTMLElement.prototype.val=function(v){
if(typeof v!=='undefined'){this.value=v;return this;}
else{return this.value}
}
Then :
document.getElementById('myDiv').val() ==== $('#myDiv').val()
And
document.getElementById('myDiv').val('newVal') ==== $('#myDiv').val('newVal')
العكس INVERSE :Converselyو if you want to add value property to jQuery object , follow those steps :
Download the full source code (not minified) i.e: example http://code.jquery.com/jquery-1.11.1.js .
Insert Line after L96 , add this code value:"" to init this new prop

Search on jQuery.fn.init , it will be almost Line 2747

value prop : (Before return statment add this.value=jQuery(selector).val())
