82
rated 0 times
[
86]
[
4]
/ answers: 1 / hits: 23663
/ 11 Years ago, sat, march 2, 2013, 12:00:00
Is there any alternative solution (in JavaScript) for document.getElementById();
to select a specific element, specifying both the class and id ?
for example I have such a content:
<a class=q_href onclick=showQuestion(1)>Question 1:</a>
<div class=q_content id=1></div>
<a class=q_href onclick=showQuestion(2)>Question 2:</a>
<div class=q_content id=2></div>
And I want to select the corresponding div under the Question X link in the function
function showQuestion(id)
{
var thediv = GetByClassAndId(q_content,id); // how to implement this function ?
WriteQuestionIn(thediv); //Ajax
}
Thanks in advance.
More From » html