javascript - How to get class names? -


Hey, I'm trying to get the script dynamically under script.

I have separate class names that are created through PHP, they need to use jQuery dynamically.

As you can see below, it seems that in 2 areas I need to get the class name. At the moment it is hard coded (classes are named 'results'):

1) var new_content = $ (' #hiddenresult div.result : eq (' + Page_index +

2) var num_entries = $ (' #hiddenresult div. Result '). Length;

Therefore, I would like jquery to get the name of the class instead, as seen below ./javascript "gt; function pageselect callback (Page_index , Jike E) {var new_content = $ ('# hidden page page: eq (' + page_index + ')') .clone (); $ ('#Searchresult') empty () attached (NEW_CONTENT). Description is false;} / ** * Callback function for AJAX content loader. * / Function initPagination () {var num_entries = $ ('# hiddenresult div.result'). Length; // Pagination element $ (" # Marking "). Pagination (num_entries, {num_edge_entries: 2, num_display_entries: 8, Callback: pageselectclallback, items_per_page: 1}); } // Load the HTML snippet with AJAX and insert it in the hidden content. When HTML is loaded, call int pageginning to endorse elements $ (document) .ready (function () {initPagination ( );}); & Lt; / Script & gt;

Any help in implementing a solution would be great thanks

If I understand correctly, you want your code to work, despite divs.

  var new_content = $ ('# hiddenresult div [class]: eq (' + page_index + ') '.clone ();  

and

  var num_entries = $ (' # hidden divorch [class] ') Length; < / Code> 

Which means that any div is defined under #hiddenresult in which the class attribute is defined (regardless of the actual class name ..)


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -