There are some dynamically generated text buttons within me. However, sometimes there will be no text in it, so I I want to hide the button with jQuery Although I can not seem to do this work
Below is my code:
$ ('internal: empty'). mother-father (). Remove (); & Lt; Button & gt; & Lt; Span class = "inner" & gt; {{Dynamic1}} & lt; / Span & gt; & Lt; / Button & gt; & Lt; Button & gt; & Lt; Span class = "inner" & gt; {{Dynamic2}} & lt; / Span & gt; & Lt; / Button & gt; & Lt; Button & gt; & Lt; Span class = "inner" & gt; {{Dynamic3}} & lt; / Span & gt; & Lt; / Button & gt; & Lt; Button & gt; & Lt; Span class = "inner" & gt; {{Dynamic4}} & lt; / Span & gt; & Lt; / Button & gt;
Thanks.
This meets your needs, you just need to use quotation marks around your selector And call instead of removal. Google works with all versions of jQuery available on jQuery CDN (1.2.3 - 2.1.1)
$ (document) .ready (function () {// You 'hide' If you want it to be purged with 'DOM', then with 'Remove'. $ ('Internal: empty') .Parent (.) Hide ();});
& lt; Script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Button & gt; & Lt; Span class = "inner" & gt; Hello & lt; / Span & gt; & Lt; / Button & gt; & Lt; Button & gt; & Lt; Span class = "inner" & gt; & Lt; / Span & gt; & Lt; / Button & gt; & Lt; Button & gt; & Lt; Span class = "inner" & gt; World & lt; / Span & gt; & Lt; / Button & gt; & Lt; Button & gt; & Lt; Span class = "inner" & gt; & Lt; / Span & gt; & Lt; / Button & gt;
No comments:
Post a Comment