EmptyWaterHoles EmptyWaterHoles - 18 days ago 7
ASP.NET (C#) Question

show() method in jquery not working

I have the following code.

$(document).ready(function() {
var factoryImage = document.getElementById("photo");
factoryImage.src = document.getElementById('<%= FactoryImageFileNameHF.ClientID %>').value;

I have the following script source for jquery.

<script src="/Scripts/jquery-3.0.0.min.js" type="text/javascript"></script>

I get the following error.

jQuery.Deferred exception: factoryImage.show is not a function TypeError: factoryImage.show is not a function
at HTMLDocument.<anonymous> (http://localhost:3373/Intranet/OHS/InteractiveMap/FactoryLayoutSettings.aspx:403:38)
at j (http://localhost:3373/Scripts/jquery-3.0.0.min.js:2:29588)
at k (http://localhost:3373/Scripts/jquery-3.0.0.min.js:2:29902) undefined

which is right on the line factoryImage.show();

Here is the image

<img id="photo" src="/Icons/Factory Layout.png" style="display:none"/>

and I can confirm that factoryImage in the jquery is not null or undefined.
There is something I am missing which I know will be easy but I can't figure it out. Why is the show method not working?


The problem is that factoryImage is not a jQuery element but a DOM element, this should work

$(document).ready(function () {
    var factoryImage = $("#photo");                        
    factoryImage.attr("src", document.getElementById('<%= FactoryImageFileNameHF.ClientID %>').value);