简体   繁体   中英

How to remove the value for text field/text_area field

I have 2 text field (1 text field and another 1 text area field)

If user enters the input into the (#accession_number) text field, then suddenly realized it's the wrong field, they would have to click the #FASTA_p to show (#FASTA) text area field and hide (#accession_number) field.

Problem : The values of (#accession number) is still there even after clicking hide . How should i totally remove the input user entered ?

For example: I chosed the wrong field and input my values but I haven't click submit. I realized i entered in the wrong field, so i clicked another field to enter my input but at the same time i want to remove the values in the first field. How should i do that besdie asking user to do it manually? 在此处输入图片说明

you could simply do

$("#FSTA").show().val($("#accession_number").val())
$("#accession_number").hide().val("")

You can set the default text value as follows,

$('#accession_number').prop( 'defaultValue' );

Have a look http://jsfiddle.net/kHBsD/8/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM