HTML img onclick Javascript
here you go. <img src=”https://i.imgur.com/7KpCS0Y.jpg” onclick=”window.open(this.src)”>
here you go. <img src=”https://i.imgur.com/7KpCS0Y.jpg” onclick=”window.open(this.src)”>
You can add a simple css3 rule in the body or in specific div, use pointer-events: none; property.
When this anchor will contain only one function to handle on click, than you can just write document.getElementById(‘anchorID’).onclick=function(){/* some code */} otherwise, you have to use DOM method addEventListener function clickHandler(){ /* some code */ } var anchor = document.getElementById(‘anchorID’); if(anchor.addEventListener) // DOM method anchor.addEventListener(‘click’, clickHandler, false); else if(anchor.attachEvent) // this is for IE, because … Read more
From the documentation of bind and click : bind : As of jQuery 1.7, the .on() method is the preferred method for attaching event handlers to a document. The source makes it clear there’s no reason to use bind, as this function only calls the more flexible on function without even being shorter : bind: … Read more
The id you have with the include tag is assigned to the root View of the included layout. First get a reference to that View using findViewByid. Then you can call findViewById on that specific View to get a reference to a View inside the layout. So: View myLayout = findViewById( R.id.cell1 ); // root … Read more
On your EditText set attributes android:focusable=”false” and android:enabled=”true”. And set OnClickListener to that EditText. The click on that Edittext triggers the onClick() method but it can’t be edited. I just tried it.
Use a binding, like in this example: <a href=”#new-search” data-bind=”click:SearchManager.bind($data,’1′)”> Search Manager </a> var ViewModelStructure = function () { var self = this; this.SearchManager = function (search) { console.log(search); }; }();
From this article on web.archive.org : The trick is to use the OnClientClick and UseSubmitBehavior properties of the button control. There are other methods, involving code on the server side to add attributes, but I think the simplicity of doing it this way is much more attractive: <asp:Button runat=”server” ID=”BtnSubmit” OnClientClick=”this.disabled = true; this.value=”Submitting…”;” UseSubmitBehavior=”false” … Read more
The quick and dirty way is to simply swap out the iframe with one that has autoplay=1 set using jQuery. THE HTML Placeholder: <div id=”videoContainer”> <iframe width=”450″ height=”283″ src=”https://www.youtube.com/embed/VIDEO_ID_HERE?wmode=transparent” frameborder=”0″ allowfullscreen wmode=”Opaque”></iframe> </div> Autoplay link: <a class=”introVid” href=”#video”>Watch the video</a></p> THE JQUERY The onClick catcher that calls the function jQuery(‘a.introVid’).click(function(){ autoPlayVideo(‘VIDEO_ID_HERE’,’450′,’283′); }); The function /*——————————– … Read more
There’s no ‘onclick’ event for an iframe, but you can try to catch the click event of the document in the iframe: document.getElementById(“iframe_id”).contentWindow.document.body.onclick = function() { alert(“iframe clicked”); } EDIT Though this doesn’t solve your cross site problem, FYI jQuery has been updated to play well with iFrames: $(‘#iframe_id’).on(‘click’, function(event) { }); Update 1/2015 The … Read more