/    Sign up×
Community /Pin to ProfileBookmark

Onclick at an icon inside a form

Hello,

I want to add an icon inside a form and be able to click it and run javascript code once clicked.Basically,i know how to add the icon on the form but i don’t know how to make it clickable with OnClick.

the input code for the text field is

[code=html]<input id=”cool” style=” width:45&#37;;

padding:4px; padding-right:25px;” type=”text” name=”game” > [/code]

and the css code for the icon

[code=html]
#cool {
background: url(game.jpg) no-repeat scroll 448px -1px;;

cursor:hand;
cursor:pointer;
}
[/code]

But i don’t know as i said where i should place OnClick command in order to make [B]only[/B] the icon clickable.Thanks.

to post a comment
JavaScript

1 Comments(s)

×

Success!

Help @jojo13 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.20,
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,
)...