.append: clear input value onclick
I have a bookmarklet that appends the body to br开发者_如何学编程ing up a little litebox. In that litebox there is a form. When the user clicks on an input field I want the current value to disappear. This is what I have tried so far and it isn't working.
function runthis() {
$('body').append("<p><input type='text' name='story_price' value='Price' onClick='this.value=''' /><p>");}
I have also tried this and it doesn't allow my bookmarklet to show up:
function runthis() {
$('body').append("<p><input type='text' name='story_price' value='Price' onClick='this.value=""' /><p>");}
Any thoughts on how I could possible clear the contents within the .append
Thanks!
Escape your quotes
("It is 'OK' to use single quotes inside double")
('This isn't OK') - should be ('This isn\'t OK')
function runthis() {
$("body").append('<p><input type="text" name="story_price" value="Price" onClick="this.value=\'\'" /><p>');}
精彩评论