Photos Displayed












-1















How do I disable the submit button once the photos is displayed on the page? Anyone knows?
Here's my code:



        if("#pic" == true){
}
else{
$("#submit").click(function () {
var button = $(this);
button.attr('disabled', 'disabled');
});

}









share|improve this question

























  • stackoverflow.com/questions/15122526/disable-button-in-jquery

    – JP4
    Nov 27 '18 at 0:36











  • the submit button need to disabled when the photo is displayed

    – Rod
    Nov 27 '18 at 0:37






  • 1





    Do you have some sort of variable keeping track of whether the photo is displayed or not?

    – JP4
    Nov 27 '18 at 0:39











  • Just to let you know you're missing a closing bracket for the first if statement. if("#pic" == true){ //if block }else{ //else block }

    – Sarah
    Nov 27 '18 at 0:42













  • Possible duplicate of Disable button in jQuery

    – Rob
    Nov 27 '18 at 0:46
















-1















How do I disable the submit button once the photos is displayed on the page? Anyone knows?
Here's my code:



        if("#pic" == true){
}
else{
$("#submit").click(function () {
var button = $(this);
button.attr('disabled', 'disabled');
});

}









share|improve this question

























  • stackoverflow.com/questions/15122526/disable-button-in-jquery

    – JP4
    Nov 27 '18 at 0:36











  • the submit button need to disabled when the photo is displayed

    – Rod
    Nov 27 '18 at 0:37






  • 1





    Do you have some sort of variable keeping track of whether the photo is displayed or not?

    – JP4
    Nov 27 '18 at 0:39











  • Just to let you know you're missing a closing bracket for the first if statement. if("#pic" == true){ //if block }else{ //else block }

    – Sarah
    Nov 27 '18 at 0:42













  • Possible duplicate of Disable button in jQuery

    – Rob
    Nov 27 '18 at 0:46














-1












-1








-1








How do I disable the submit button once the photos is displayed on the page? Anyone knows?
Here's my code:



        if("#pic" == true){
}
else{
$("#submit").click(function () {
var button = $(this);
button.attr('disabled', 'disabled');
});

}









share|improve this question
















How do I disable the submit button once the photos is displayed on the page? Anyone knows?
Here's my code:



        if("#pic" == true){
}
else{
$("#submit").click(function () {
var button = $(this);
button.attr('disabled', 'disabled');
});

}






javascript jquery ajax






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 27 '18 at 1:12







Rod

















asked Nov 27 '18 at 0:13









RodRod

307




307













  • stackoverflow.com/questions/15122526/disable-button-in-jquery

    – JP4
    Nov 27 '18 at 0:36











  • the submit button need to disabled when the photo is displayed

    – Rod
    Nov 27 '18 at 0:37






  • 1





    Do you have some sort of variable keeping track of whether the photo is displayed or not?

    – JP4
    Nov 27 '18 at 0:39











  • Just to let you know you're missing a closing bracket for the first if statement. if("#pic" == true){ //if block }else{ //else block }

    – Sarah
    Nov 27 '18 at 0:42













  • Possible duplicate of Disable button in jQuery

    – Rob
    Nov 27 '18 at 0:46



















  • stackoverflow.com/questions/15122526/disable-button-in-jquery

    – JP4
    Nov 27 '18 at 0:36











  • the submit button need to disabled when the photo is displayed

    – Rod
    Nov 27 '18 at 0:37






  • 1





    Do you have some sort of variable keeping track of whether the photo is displayed or not?

    – JP4
    Nov 27 '18 at 0:39











  • Just to let you know you're missing a closing bracket for the first if statement. if("#pic" == true){ //if block }else{ //else block }

    – Sarah
    Nov 27 '18 at 0:42













  • Possible duplicate of Disable button in jQuery

    – Rob
    Nov 27 '18 at 0:46

















stackoverflow.com/questions/15122526/disable-button-in-jquery

– JP4
Nov 27 '18 at 0:36





stackoverflow.com/questions/15122526/disable-button-in-jquery

– JP4
Nov 27 '18 at 0:36













the submit button need to disabled when the photo is displayed

– Rod
Nov 27 '18 at 0:37





the submit button need to disabled when the photo is displayed

– Rod
Nov 27 '18 at 0:37




1




1





Do you have some sort of variable keeping track of whether the photo is displayed or not?

– JP4
Nov 27 '18 at 0:39





Do you have some sort of variable keeping track of whether the photo is displayed or not?

– JP4
Nov 27 '18 at 0:39













Just to let you know you're missing a closing bracket for the first if statement. if("#pic" == true){ //if block }else{ //else block }

– Sarah
Nov 27 '18 at 0:42







Just to let you know you're missing a closing bracket for the first if statement. if("#pic" == true){ //if block }else{ //else block }

– Sarah
Nov 27 '18 at 0:42















Possible duplicate of Disable button in jQuery

– Rob
Nov 27 '18 at 0:46





Possible duplicate of Disable button in jQuery

– Rob
Nov 27 '18 at 0:46












1 Answer
1






active

oldest

votes


















0














here's the modified code






$('#pic').on('load', function() {
console.log("loaded");

$('#submit').attr('disabled',true);
})

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<img id="pic" src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" />

<button id="submit">hello</button>





if the img source is improper it won't render and the load method is hence not called, so we are sure of the proper image source and after rendering it calls the Load method in which you can disable your button






share|improve this answer
























  • If I want to display 5 photos that the user uploaded how should I write the source load method?

    – Rod
    Nov 27 '18 at 5:54











  • the photos are in the loop $("#photo" + i)

    – Rod
    Nov 27 '18 at 5:55











  • pls share entire snippet of upload + html

    – Yash Soni
    Nov 27 '18 at 5:59











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53490974%2fphotos-displayed%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














here's the modified code






$('#pic').on('load', function() {
console.log("loaded");

$('#submit').attr('disabled',true);
})

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<img id="pic" src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" />

<button id="submit">hello</button>





if the img source is improper it won't render and the load method is hence not called, so we are sure of the proper image source and after rendering it calls the Load method in which you can disable your button






share|improve this answer
























  • If I want to display 5 photos that the user uploaded how should I write the source load method?

    – Rod
    Nov 27 '18 at 5:54











  • the photos are in the loop $("#photo" + i)

    – Rod
    Nov 27 '18 at 5:55











  • pls share entire snippet of upload + html

    – Yash Soni
    Nov 27 '18 at 5:59
















0














here's the modified code






$('#pic').on('load', function() {
console.log("loaded");

$('#submit').attr('disabled',true);
})

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<img id="pic" src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" />

<button id="submit">hello</button>





if the img source is improper it won't render and the load method is hence not called, so we are sure of the proper image source and after rendering it calls the Load method in which you can disable your button






share|improve this answer
























  • If I want to display 5 photos that the user uploaded how should I write the source load method?

    – Rod
    Nov 27 '18 at 5:54











  • the photos are in the loop $("#photo" + i)

    – Rod
    Nov 27 '18 at 5:55











  • pls share entire snippet of upload + html

    – Yash Soni
    Nov 27 '18 at 5:59














0












0








0







here's the modified code






$('#pic').on('load', function() {
console.log("loaded");

$('#submit').attr('disabled',true);
})

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<img id="pic" src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" />

<button id="submit">hello</button>





if the img source is improper it won't render and the load method is hence not called, so we are sure of the proper image source and after rendering it calls the Load method in which you can disable your button






share|improve this answer













here's the modified code






$('#pic').on('load', function() {
console.log("loaded");

$('#submit').attr('disabled',true);
})

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<img id="pic" src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" />

<button id="submit">hello</button>





if the img source is improper it won't render and the load method is hence not called, so we are sure of the proper image source and after rendering it calls the Load method in which you can disable your button






$('#pic').on('load', function() {
console.log("loaded");

$('#submit').attr('disabled',true);
})

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<img id="pic" src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" />

<button id="submit">hello</button>





$('#pic').on('load', function() {
console.log("loaded");

$('#submit').attr('disabled',true);
})

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<img id="pic" src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" />

<button id="submit">hello</button>






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 27 '18 at 5:04









Yash SoniYash Soni

48510




48510













  • If I want to display 5 photos that the user uploaded how should I write the source load method?

    – Rod
    Nov 27 '18 at 5:54











  • the photos are in the loop $("#photo" + i)

    – Rod
    Nov 27 '18 at 5:55











  • pls share entire snippet of upload + html

    – Yash Soni
    Nov 27 '18 at 5:59



















  • If I want to display 5 photos that the user uploaded how should I write the source load method?

    – Rod
    Nov 27 '18 at 5:54











  • the photos are in the loop $("#photo" + i)

    – Rod
    Nov 27 '18 at 5:55











  • pls share entire snippet of upload + html

    – Yash Soni
    Nov 27 '18 at 5:59

















If I want to display 5 photos that the user uploaded how should I write the source load method?

– Rod
Nov 27 '18 at 5:54





If I want to display 5 photos that the user uploaded how should I write the source load method?

– Rod
Nov 27 '18 at 5:54













the photos are in the loop $("#photo" + i)

– Rod
Nov 27 '18 at 5:55





the photos are in the loop $("#photo" + i)

– Rod
Nov 27 '18 at 5:55













pls share entire snippet of upload + html

– Yash Soni
Nov 27 '18 at 5:59





pls share entire snippet of upload + html

– Yash Soni
Nov 27 '18 at 5:59




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53490974%2fphotos-displayed%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks