How can I write below programming in jquery
function abc(a,b,c)
{
alert('a :'+a+' b:'+ b);
xyz(c);
}
funct开发者_运维百科ion xyz(c)
{
alert('c :' + c);
}
<a href="javascript:abc(1,2,3)" >click here to check value of abc </a>
This is a wild guess but I think you might want to rename link to something like
<a id='myId'>click here ...</a>
And do the following in jquery
$(document).ready(function(){$('#myId').click(function(){
abc(1,2,3)})});
Jquery is a javascript framework, not a programming language.
You could fire the event using this:
$(document).ready(function(){$('some-id').click(abc(1, 2, 3))});
function abc(a,b,c) {
alert('a :'+a+' b:'+ b);
xyz(c);
}
function xyz(c) {
alert('c :' + c);
}
...
<a id="some-id">click here to check value of abc </a>
jQuery is a JavaScript library whose purpose is to make some browser scripting tasks easier. It is not a replacement for JavaScript. Don't try to use it for everything.
Also, using onclick
is preferable to using the javascript:
pseudo-protocol in a link, and you should provide a real URL for the link to take the user when they have JavaScript turned off:
<a href="non_js_alternative.html" onclick="abc(1, 2, 3);">click here to check value of abc </a>
精彩评论