Please see this fiddle: http://jsfiddle.net/ZWw3Z/5/ My code is: I would like to trigger a click event only on the pseudo-element (the red bit). That is, I don’t want the click event to be triggered on the blue bit. Answer This is not possible; pseudo-elements are not part of the DOM at all so you can’t bind any events directly to
Include jQuery in the JavaScript Console
Is there an easy way to include jQuery in the Chrome JavaScript console for sites that do not use it? For example, on a website I would like to get the number of rows in a table. I know this is really easy with jQuery. The site does not use jQuery. Can I add it in from the command line?
JavaScript: Scroll to selection after using textarea.setSelectionRange in Chrome
A JavaScript function selects a certain word in a textarea using .setSelectionRange(). In Firefox, the textarea automatically scrolls down to show the selected text. In Chrome (v14), it does not. Is there a way to get Chrome to scroll the textarea down to the newly selected text? jQuery solutions are welcome. Answer Here is a simple and efficient solution in
How to trim a string to N chars in Javascript?
How can I, using Javascript, make a function that will trim string passed as argument, to a specified length, also passed as argument. For example: Anyone got ideas? I’ve heard something about using substring, but didn’t quite understand. Answer Why not just use substring… string.substring(0, 7); The first argument (0) is the starting point. The second argument (7) is the
event.target on Firefox
Works fine on Google Chrome and IE but not on Firefox. Tried it on Google. Google says event.srcElement (works on IE but not on Firefox) so I have added event.target but still not working. Is there anymore changes I need to do to work on Firefox? By the way I’m using 3.5 version of Firefox. Please help me to make
How to include javaScript file in xslt
How can I include/import javaScript file/libary in xslt file. Answer If you need to use the javascript in the transformation (for example, it contains a set of extension functions that are called within the transformation), you need to put the javascript contents (at least that of one javascript file) in a separate XSLT stylesheet file, using the proper extension element
How to read data From *.CSV file using JavaScript?
My CSV data looks like this: How do you read this data and convert to an array like this using JavaScript?: I’ve tried this code but no luck!: Answer NOTE: I concocted this solution before I was reminded about all the “special cases” that can occur in a valid CSV file, like escaped quotes. I’m leaving my answer for those
in javascript, how do you sort a subset of an array?
I have an array and would like to sort all but the last n elements. For example, if the array is 10 elements long, would like elements 0 through 7 to be sorted while elements 8-9 are left in place. Answer
Highcharts DateTime Localization
Can someone point me to how I can localize the date-related Strings which are hardcoded in the HighCharts js-file. For instance, instead of the default ‘Feb’ date label in the x-axis, I would want the chart to display the localized value ‘Fév’. I tried implementing the localization by setting the options on the language object before the chart is instantiated:
How to uppercase Javascript object keys?
Anyone know a good way to turn this?: into: Answer Loop through delete and replace: