1

I am facing difficulties for styling my form. This is the HTML code snippet of the web page.

<li class="gchoice_8_8_0">
 <div class="tetapose_radio">
  <input id="choice_8_8_0" type="radio" onclick="gf_apply_rules(8,[0,33,38,39,9,10,89,91,35,34]);" tabindex="16" value="0|0" name="input_8">
  <label for="choice_8_8_0"></label>
 </div>
 
 <label id="label_8_8_0" for="choice_8_8_0">
 <span class="column">
  Code
 </span>
 </label>
</li>

Now, what I want to do is style the span in the label which is out of the div tag wrapped around radio input

I tried this code with no luck

li .tetapose_radio input[type="radio"]:checked ~ li label .column { 
 box-shadow: 0px 4px 10px #1f8bcf !important;
 border-bottom: 1px solid #fff;
 z-index: 999;
}

We can use

:checked + label 

But it works only on label that immediately follows the input tag.

This is the code from WordPress site and div tag is wrapped by the theme itself, I don't know how to remove that tag. If anyone knows how to remove div tag wrapped around radio button using function then that would be awesome.

Otherwise CSS trick would do fine.

2 Answers2

0

I guess you can use a preg_match with this regex which return the content of the div,

#<div.*(?<=class=)"tetapose_radio".*>(.*)<\/div>#sU

and then replace the div with the input inside with the content returned by the preg_match (to find the div you can use the same regex).

Normally it will do the trick :)

hornfl4kes
  • 120
  • 1
  • 9
  • If you are talking about removing DIV then I didn't get your point. – Ashutosh Soni Mar 23 '15 at 08:35
  • Can you please elaborate? – Ashutosh Soni Mar 23 '15 at 08:36
  • If i get your first question you want to extract input and label out of the div ? If so, by using my regex you'll have the content of the div. Then you remplace the full div by his own content. `
    Lorem
    replaced by Lorem` Heres the code in php : `preg_replace("#(.*)#sU", "$1", $str)`
    – hornfl4kes Mar 23 '15 at 10:41
  • First of all let me tell you that I am no pro with coding. Just a newbie trying to learn. Although I went ahead and used your code like this function filter_divtags_on_radio($str) { return preg_replace('#(.*)#sU', '$1', $str); } add_filter('the_str', 'filter_divtags_on_radio'); It gave me syntax error... What went wrong? – Ashutosh Soni Mar 28 '15 at 09:20
  • Be careful of the quote, I made a mistake with my quote on my preg_replace function. Some must be simple quote. Check yours :) `preg_replace('#(.*)#sU', "$1", $str)` – hornfl4kes Mar 28 '15 at 20:57
0

Ok I found a way around.

It was a problem of gravity forms custom fields. I replaced the custom fields to normal fields and now

label is inside the div tag.

So, now I can style It :D

Thanks for your responses...