Using javascript in Jquery
Hi all,
This is my first post to this forum.
I had some javascript that was working great and then I added some jQuery that works great on its own but the two don't work great together. So now I want to embed the javascript in the jquery. But it's harder than I thought.
Here's what I've got:
$(document).ready(function() {
$('#submit').css('display', 'none');
$('#deepshare').click( function(e) {
$('#submit').css('display', 'inline');
e.stopPropagation();
$('#deepshare').css({color: '#000'});
if(this.value==this.defaultValue)this.value='';
});
$('#deepshare').add('#deepshareBackground').click( function(e) {
e.stopPropagation();
});
$(document).click(function(){
$('#submit').hide();
*****if(this.value=='')this.value=this.defaultValue; this.style.color = '#999';} else {this.style.color = '#000';}******
});
});
It's the last bit of javascript that's not working (the bit in asterisks). What I'm trying to do is get the textarea (id=deepshare) to revert back to its original text if the user clicks outside it (and its related area) and revert back to the original css too.
I don't get why the javascript code for the second variable - (this.value==this.defaultValue)this.value='';) - works fine, but not the js code for the final one.
Really confused. Any help much appreciated.
J