jQuery 1.8.3 - How activate element from dynamic content?
Hi,
The problem can be found in many places - but no good solution. The dynamic reloaded contents can not be accessed from an pre-loaded scripts. Can someone make an example ?
This is my script:
HTML:
- <select id="test">
- <option value="2014">2014</option>
- <option value="2015">2015</option>
- </select>
- <div id="showme"></div>
SCRIPT:
- $("#test").on("change", function()
- {
- $.get("mysite.php?myvalue=" + $("#test").val(), function(data)
- {
- ;$("#showme").html(data);
- });
- });
- $('.field213').click(function() { $(".feldfield213").html("itsworking");}
- $('.more').click(function() { $(".more").html("itsworking");}
The result from "mysite.php" like this:
- <span class="field213" rel="12">test</span><span class="field2213" rel="144">test</span><span class="hi5" rel ="99">test</span>
- <span class="more">test</span>
(about 100 different span - classes)
How can i activate this classes after $.get?