You can like this…
document.getElementById('my-image').ondragstart = function() { return false; };
See it working (or not working, rather)
It seems you are using jQuery.
$('img').on('dragstart', function(event) { event.preventDefault(); });
More Related Contents:
- How can I modify with css an image appended with javascript?
- How to silently hide “Image not found” icon when src source image is not found
- Center an Image vertically and horizontally using CSS
- How to have html popup appear over main html page?
- Write tags in HTML and print
- Change from (+) symbol to (-) after click (function(){
- How can i create html automatic change page? [duplicate]
- Height equal to dynamic width (CSS fluid layout) [duplicate]
- How to disable HTML links
- Cross-browser multi-line text overflow with ellipsis appended within a fixed width and height
- Refresh/reload the content in Div using jquery/ajax
- Animate element to auto height with jQuery
- How to style “input file” with CSS3 / Javascript? [duplicate]
- How to get nth-child selector to skip hidden divs [duplicate]
- How to auto-scroll to end of div when data is added? [duplicate]
- Text blinking jQuery
- :touch CSS pseudo-class or something similar?
- CSS3-Animate elements if visible in viewport (Page Scroll)
- Open a new javascript window(.open) along with its CSS styling
- How to create a responsive image that also scales up in Bootstrap 3
- Check if element is between 30% and 60% of the viewport
- Make image fill div completely without stretching
- How do I make a move up and down when I’m scrolling the page?
- Fade background image in and out with jQuery?
- How do I detect the inherited background-color of an element using jQuery/JS?
- Convert dropdown to selection boxes with color and trigger drop down action
- Large dynamically sized html table with a fixed scroll row and fixed scroll column
- Wrapping lists into columns
- How should I crop an image at client side using jcrop and upload it?
- Possible to reverse a css animation on class removal?