开发者

call function on link

i have one function in jquery like this

   $("#Button_save").click(function() 
    {
    Save Command;

    });

this work fine with image

<img src="save.png" width="16" height="16" id="Button_save" style="cursor:pointer"/>

i want to call same function on text h开发者_JAVA技巧yper link i use this

   <a href="#" onclick="javascript:Button_save();">SAVE</a>

but not working...

Thanks


<a href="#" class="funcLink">Click Me</a>

--

$("a.funcLink").click(function(e){
  e.preventDefault();
  Button_Save();
});

--

One other thing you may consider is using a link this this <a href="enable-javascript.html" class="funcLink">Click Me</a> instead, which will inform the visitor that your site requires javascript to operate properly. Of course when Javascript is enabled, the javascript provided above will cancel out the default action, and the user will never know the enable-javascript page event exists.

It's a fall-back plan for good design.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜