Loading...
Copy code
Close
Permalink
Close
Please tell us why you want to mark the subject as inappropriate.
(Maximum 200 characters)
Report Inappropriate
Cancel
Private Message
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Cancel
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Update
Cancel
Feedback
Email ID
Subject :
Comments :
Send
Cancel
Private Message
Type the characters you see in the picture below.
Type the characters you see in the picture below.
Attach files
Desktop
Google Docs
Each Attachment size should not exceed 1.0 MB.
Max no of attachments : 3
Loading User Profile...
guest
Response title
This is preview!
Attachments
Publish
Back to edit
Cancel
(
)
Sign In
New to this Portal? Click here to
Sign up
You can also use the below options to login
Login with Facebook
Login with Google
Login with Yahoo
jQuery
Plugins
UI
Meetups
Forum
Blog
About
Donate
All Forums
Recent Posts
Log In
Search
jQuery
Search
jQuery Forum
Screen name:
alex.serjapin
alex.serjapin's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Ideas
Problems
Expanded view
List view
Private Message
Hide selected id with jQuery
[2Replies]
07-Nov-2012 05:49 AM
Forum:
Using jQuery
Hello everyone, I am stuck at part where I click a button, next which id=getOffer it hides, the button id=gotOffer shows up. In this code I have 50 buttons as you can see.
If I delete these "+i" 's code works just for first button.
Can anyone help me please? Thanks
<script type="text/javascript">
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","xml/20121106.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
var x=xmlDoc.getElementsByTagName("promotion");
for (i=1;i<(x.length=50);i++)
{
$("#getOffer"+"i").click(function () {
$("#getOffer"+"i").hide();
$("#gotOffer"+"i").show();
});
$("#gotOffer"+"i").click(function () {
$("#gotOffer"+"i").hide();
$("#getOffer"+"i").show();
});
document.write("<div class='oneDeal'>");
document.write("<div class='imgDeal'>");
document.write(x[i].getElementsByTagName("PROGRAMURL")[0].childNodes[0].nodeValue);
document.write("</div><div class='nameDeal'>");
document.write(x[i].getElementsByTagName("DESCRIPTION")[0].childNodes[0].nodeValue);
document.write("</div><div class='linkDeal'>");
document.write("<input type='button' class='offer' id='getOffer"+i+"' value='Click for Code' onclick='click()'><input type='button' class='offer' id='gotOffer"+i+"' style='display:none' onclick='click()'>");
document.write("</div>");
document.write("</div>");
}
</script>
«Prev
Next »
Moderate user : alex.serjapin
Forum