web developing
4 Jul
Particularly in that case I’m using jQuery which is enough famous, so I’m not going to introduce it, but however you can use any library, and this remains of your choice. The interesting part here is that I didn’t find a jQuery specific OS detecting plugin.
Well the guru PPK has the right answer, which is working with every JavaScript library … because it’s pure JavaScript itself. Read the rest of this entry »
4 Jul
If you’re familiar with jQuery, which I suppose is true, you know how to select an element, for instance if there’s an element with id element_id, you do:
$('#element_id')
if ( $('#element_id').length > 0 )
console.log('the element with element_id
exists in the DOM');
Note: that console.log is present as console writing function under FF and Safari only.
Than $(’#element_id’).length equals to 0
if ( $('#element_id').length == 0 )
console.log('the element with element_id
don't exists in the DOM');
2 Jul
If you’ve to debug some script in Safari, and you’d wish to write into the javascript console, the simple advice is to use the same code as in Firefox.
console.log(object);
That’s all.