onpaste event
Definition and Usage
The onpaste event occurs when the user pastes content into an element.
Although all HTML elements support the onpaste event, it is actually impossible to paste content into elements like <p> unless the element has contenteditable set to "true" (see more examples below).
সুঝান: The onpaste event is mainly used for <input> elements with type="text".
সুঝান:You can paste content into an element in three ways:
- CTRL + V
- Select paste from the browser's edit menu
- In the right-click menu, select the paste command
প্রতিদর্শন
উদাহরণ 1
When you paste some text in the <input> element, execute JavaScript:
<input type="text" onpaste="myFunction()" value="Paste something in here">
উদাহরণ 2
When you paste some text in the <p> element, execute JavaScript (note that contenteditable is set to "true"):
<p contenteditable="true" onpaste="myFunction()">Try to paste something inside this paragraph.</p>
ব্যবহারিক বিবরণ
এইচটিএমএল-এ:
<এলিমেন্ট onpaste="myScript">
জাভাস্ক্রিপ্টে:
ওবজেক্ট.onpaste = function(){myScript};
জাভাস্ক্রিপ্টে, addEventListener() পদ্ধতি ব্যবহার করে:
ওবজেক্ট.addEventListener("paste", myScript);
মন্তব্য:Internet Explorer 8 বা আরও পুরানো সংস্করণগুলির দ্বারা সমর্থিত না addEventListener() পদ্ধতি。
কারিগরি বিবরণ
বালা হয়: | সমর্থন |
---|---|
বাতিল করা যায়: | সমর্থন |
ঘটনা ধরন: | ClipboardEvent |
সমর্থিত HTML ট্যাগ: | সমস্ত HTML ইঞ্জেকশন |
ব্রাউজার সমর্থন
ইভেন্ট | চ্রোম | আইই | ফায়ারফক্স | স্যাফারি | ওপেরা |
---|---|---|---|---|---|
onpaste | সমর্থন | সমর্থন | সমর্থন | সমর্থন | সমর্থন |
সংশ্লিষ্ট পাতা
HTML DOM রেফারেন্স ম্যানুয়েল:oncopy ইভেন্ট
HTML DOM রেফারেন্স ম্যানুয়েল:oncut ইভেন্ট