TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
2.1k
482.1k
Making your ID element not to duplicate data in Jquery
Nov 19 2019 7:30 AM
Hi team
I want to find a way to make my ID element not to duplicate data in my Jquery, basically my Jquery needs to reference my ID element from my button ID. I have one button that has ID element, this ID is been referenced on my Jquery for the checkbox. Problem i am having now, that ID from my button is making a duplication not to distinguish itself from other checkbox reference. Is there way that is better, where i can amend my ID not to reference on ID element throughout my document element on Jquery?
<!---Downloading File using
Jquery with Buttons---->
<div class="form-group"><br>
<div class="col-md-1.9 text-center">
<button id="download" name="download" class="btn btn-warning">Download</button><br>
</div>
</div>
// checking for one field entry to read.
$(document).ready(function() {
$('#download').click(function() {
var xcount = 0;
if($('.temperature').prop('checked')) xcount--;
if(xcount < 1) {
window.location.href ='https://api.thingspeak.com/channels/899906/fields/1.csv';
}
});
});
// checking for two field entry to read.
$(document).ready(function() {
$('#download').click(function() {
var mcount = 0;
if($('#illuminance').prop('checked')) mcount--;
if(mcount < 1) {
window.location.href ='https://api.thingspeak.com/channels/899906/fields/2.csv';
}
});
});
// checking for third entry to read.
$(document).ready(function() {
$('#download').click(function() {
var tcount = 0;
if($('.button-state').prop('checked')) tcount--;
if(tcount < 1) {
window.location.href ='https://api.thingspeak.com/channels/899906/fields/8.csv';
}
});
});
Reply
Answers (
1
)
How to make tag attribute ID unique in Jquery
Dictionary in Python