I won’t say much nonsense, I will just post the key code to you. The specific code is as follows:
<!DOCTYPE html><html><head><metacharset="UTF-8"><title>Input box clear button</title><scriptsrc="js/jquery1.8.3.min.js"></script><script>/*** Check the value of the current input box. If it is not empty, the clear button is displayed* @param element*/functioncheckInput(element){var value = $(element).val();if(value!=null&&''!=value)$(element).parent().parent().children().children().children('.button').removeClass('none');else$(element).parent().parent().children().children().children('.button').addClass('none');}/*** Clear input box content* @param element*/functionclearInput(element){$(element).parent().parent().children().children('input').val('');$(element).addClass('none');}</script><style>.none{display: none;}.height-20{height:20px;;}.button{color: red;font-size:18px;width:100px;height:18px;border:1px solid red;border-radius:5px;}</style></head><body><div><div><inputtype="text"placeholder="enter"try"onkeyup="checkInput(this);" >div><divclass="height-20" ></div><div><class="none button"onclick="clearInput(this);" >clear input</a></div></div></body></html>').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i <= lines; i++){ $numbering.append($('').text(i)); }; $numbering.fadeIn(1700); }); });The above is the linkage effect of JavaScript that the editor introduced to you to implement the input box and the clear button. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support to Wulin.com website!