JQUERY create delete button html input - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution
join us

create delete button in html input


 299

Show ResultJQUERY


2

<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('input.deletable').wrap('<span class="deleteicon" />').after($('<span/>').click(function() {
$(this).prev('input').val('').trigger('change').focus();
}));
});
</script>
<style>
span.deleteicon {
position: relative;
}
span.deleteicon span{
position: absolute;
display: block;
top: 5px;
right: 0px;
width: 16px;
height: 16px;
background-image: url('https://www.freeiconspng.com/uploads/blue-delete-button-png-29.png');
cursor: pointer;
background-size: 100% 100%;
}
span.deleteicon input {
padding-right: 16px;
box-sizing: border-box;
}
</style>
</head>
<body>
<input type="text" class="deletable" value="your value">
</body>
</html>


By        
The power of the user (%)
6%



The most helpful JQUERY solutions

plugin get client ip address using jqueryplugin get client ip address using jqueryJQUERY

Click to see more ...

  9K     1.8K

How to get client machine name or computer name with jquery?How to get client machine name or computer name with jquery?JQUERY

Click to see more ...

  12K     792

plugin detect country jqueryplugin detect country jqueryJQUERY

Click to see more ...

  4.7K     772

cookie jquerycookie jqueryJQUERY

Click to see more ...

  3.1K     411

plugin convert thousands to K jqueryplugin convert thousands to K jqueryJQUERY

Click to see more ...

  2.8K     402

show position on google map jqueryshow position on google map jqueryJQUERY

Click to see more ...

  2.2K     389

how to create a jquery plugin for converting date to days ago, month ago and year ago ?how to create a jquery plugin for converting date to days ago, month ago and year ago ?JQUERY

Click to see more ...

  2.3K     349

How to detect the version of IE browser using jquery ?How to detect the version of IE browser using jquery ?JQUERY

Click to see more ...

  2.2K     338

How to get top, right, left, bottom position of element div using jquery ?How to get top, right, left, bottom position of element div using jquery ?JQUERY

Click to see more ...

  2.1K     296

how to get ip address using jquery ?how to get ip address using jquery ?JQUERY

Click to see more ...

  1.9K     279

Welcome aboard!
We are happy you are here and
wish you good net-raft!