Is
this:
var contents =
document.getElementById('contents');
The
same as this:
var contents =
$('#contents');
Given
that jQuery is loaded?
Is
this:
var contents =
document.getElementById('contents');
The
same as this:
var contents =
$('#contents');
Given
that jQuery is loaded?
Not
exactly!!
document.getElementById('contents');
//returns a HTML DOM Object
var contents = $('#contents');
//returns a jQuery
Object
In jQuery, to get the same result as
document.getElementById, you can access the jQuery Object and
get the first element in the object (Remember JavaScript objects act similar to
associative arrays).
var contents
= $('#contents')[0]; //returns a HTML DOM
Object
I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...
No comments:
Post a Comment