/    Sign up×
Community /Pin to ProfileBookmark

call js Func when clicking a div

hi im trying to call a JS fuc when a certain div is pressed.

this is how i call it from a hyperlink
<a href=”javascript:callToActionscript(‘asjs’, ‘right’)””>right</a>

and i try to call it from the div like this

[code=html]$(‘#divOne’)(function(){
javascript(callToActionscript(‘asjs’, ‘right’))
});[/code]

which is not really working…

***EDIT***
Sorry found the mistake.

[code=html]$(‘#divOne’).mouseup(function(){
callToActionscript(‘asjs’, ‘right’)
});[/code]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@KorApr 18.2011 — I hope you are aware of the fact that your problem was a JQuery (which is one of the several known JavaScript frameworks/libraries), [I]not a native JavaScript one[/I]. And I hope you know the difference.

When you are using a JavaScript library, please specify [I]which[/I] is that library. We are not suppose to know by heart all the custom syntax of all the libraries.
×

Success!

Help @chisburg spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...