{"id":2331,"date":"2022-08-30T15:23:58","date_gmt":"2022-08-30T15:23:58","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/01\/05\/jquery-class-selector-is-not-working-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:23:58","modified_gmt":"2022-08-30T15:23:58","slug":"jquery-class-selector-is-not-working-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/jquery-class-selector-is-not-working-collection-of-common-programming-errors\/","title":{"rendered":"Jquery class selector is not working-Collection of common programming errors"},"content":{"rendered":"<p>If you just want to change the <strong>ALFL<\/strong> Text , you can do something like this :<\/p>\n<pre><code>var $span= $('span.ui-btn-text');\n$span.each(function(){\n    if ($(this).text() =='ALFL') {\n        $(this).text('A');\n    }        \n});\n<\/code><\/pre>\n<p>Js fiddle Demo : http:\/\/jsfiddle.net\/95CyN\/<\/p>\n<p>If you want to change text\/html of all span with class ui-btn-text, do this:<\/p>\n<pre><code> \/\/ change the text inside the element\n $('span.ui-btn-text').text('A');\n<\/code><\/pre>\n<p>OR<\/p>\n<pre><code> \/\/ change the html content inside the element\n $('span.ui-btn-text').html('A');\n<\/code><\/pre>\n<p>OR<\/p>\n<pre><code>  \/\/ Replace the html element\n  $('span.ui-btn-text').replaceWith('A');\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2014-01-05 10:10:57. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>If you just want to change the ALFL Text , you can do something like this : var $span= $(&#8216;span.ui-btn-text&#8217;); $span.each(function(){ if ($(this).text() ==&#8217;ALFL&#8217;) { $(this).text(&#8216;A&#8217;); } }); Js fiddle Demo : http:\/\/jsfiddle.net\/95CyN\/ If you want to change text\/html of all span with class ui-btn-text, do this: \/\/ change the text inside the element $(&#8216;span.ui-btn-text&#8217;).text(&#8216;A&#8217;); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2331","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2331"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2331\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}