Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: IE7 Javascript jQuery Browser , +
Hi all
My Code
var dataTable = "<ol>";
$.each(, function (key, value) {
                            dataTable += '<li ><a href="' + + '"  önmousedown=javascript:StoreClickedURL(' + userId + ',"' + encodeURI(userInput) + '","' + + '")>' + + '</a></li>';
 dataTable += "</ol>";

I am dynamically creating anchors.Here house down event is working fine in all browser except IE.
I searched in Google but not found any appropriate solution for this.
Please help me.
Thanks in advance
Posted 8-Nov-12 19:38pm
Edited 8-Nov-12 20:23pm
Sergey Alexandrovich Kryukov at 9-Nov-12 2:24am
You misuse jQuery. Its style is adding event handler when document is ready. Writing JavaScript event handler is HTML elements is totally redundant thing, and error-prone.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You are going in wrong direction — please see my comment to the question.
This is a jQuery pattern of doing things:
   someElement = $("#someId"); // assuming some element has id="someId"
   // generate HTML or not, does not matter
       // so something
Please see:[^],[^],[^],[^].

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,800
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,790

Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 9 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100