Featured post
javascript - Clearing a jQuery Form -
i have been doing research on way clear jquery form.
i have couple of ideas want know if has better way.
i know using reset, necessary set field particular value may not accomplished reset. (ie. if form starts pre-filled data , want clear it)
i have read discussion here: resetting multi-stage form jquery
but have idea post answer. please let me know think , if have better solution.
more information:
for example have address form. has couple of inputs, selects, radios, etc. along copy new button , clear button. default want have particular radio selected option 1.
<div id = "addresslist"> <div class = "address"> <input type="radio"/> --obviously options here <button>copy new</button> </div> </div>
the user selected option 2 , clicks copy new. on click of click of copy new:
$("#addresslist").append($(this).closest("#address").html());
in second address secon radio button selected. user selects third radio button. @ point clicking reset button reset input option 2 not option one.
my solution add attribute called clear
.
then $([clear]).val($(this).atrr('clear'))
- Get link
- X
- Other Apps
Comments
Post a Comment