jquery - Custom Share using Javascript not working as desired -


i working on simple custom share user click on share button show list of share option , user can click on 1 of them share page.

i have setup code on codepen not sure why not working.

<html>  <head>   <script src="https://code.jquery.com/jquery-2.1.4.js"></script>    <meta charset="utf-8">   <title>js bin</title> </head>  <body>   <a class="share-btn" href="#">s</a>   <div class="share"><a href="http://www.facebook.com/sharer/sharer.php?u=http://domain.com"> f</a>   </div>    <div class="share"><a  href="whatsapp://send?text=the text share!" data-action="share/whatsapp/share">w</a></div>    <div class="share"><a  href="http://twitter.com/intent/tweet?status=this title+http://domain.com/article/this-is-article ">t</a></div>   </body>  </html>      jquery(document).ready(function($) {      $('.share').click(function() {        var nwin = window.open($(this).prop('href'), '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');        if (window.focus) {          nwin.focus();        }        return false;      });    });     $(".share-btn").click(function() {      $(".share").toggle();    }); 

change $('.share').click $('.share > a').click else $(this) refers div has no property called href.

here example it: http://codepen.io/anon/pen/rwobqo

$('.share > a').click(function() { 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -