0

hello friends,
i want to get the class name from li tag
for example

<ul>
<li class="itme11"></li>
<li class="itme21"></li>
<li class="itme31"></li>
<li class="itme41"></li>
</ul>

and i want to access the class item31
how do i get the class name item31 with javascript??

plz help me to solve out

3
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by jogesh_p
0

Use JQuery my friend.

They have the best selectors.

//To set the innerHTML of <li class="item31">
// # is the ID select
// . is the class selector

$('.item31').html('My new HTML');

JQuery it's a very useful JS lib, learn it and it'll save u time =)

Seeya.

0

Use JQuery my friend.

They have the best selectors.

//To set the innerHTML of <li class="item31">
// # is the ID select
// . is the class selector

$('.item31').html('My new HTML');

JQuery it's a very useful JS lib, learn it and it'll save u time =)

Seeya.

@Seeya Thanks to taking intrust but the problem is i will use this code in joomla site to modify some part of the code, and if i use jquery then it conflicted with mootools, even i used jQuery.noConflict(); but still it conflicted with mootool, thats why i used javascript, but now i did that with some other logic without javascript, but still i want to do this cause i am not good in javascript, but just know some jquery..

0

You can have jQuery + Mootols without conflict, or jQuery with Prototype without conflict, etc. Apart from the noConflict(), have you tried having all jQuery stuff (lib, plugs, code)loaded first, then the rest of js?

0

To avoid conflict, use "JQuery." insted of "$."

I tried jQuery instead of $ but the problem was i call the jquery.min.js file form the ajax.googleapis.com, i did it separately into my joomla directory, and then it worked with jQuery.noConflict(); and used jQuery instead of $ without any conflicting with mootools..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.