Photos Displayed
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
add a comment |
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
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
add a comment |
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
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
javascript jquery ajax
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
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
add a comment |
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
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
add a comment |
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
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>
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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