I am trying to learn Jquery. Having a problem in dynamically changing the Text of label.
Here is my code
I have
$db = new db();
$rings = $db->query("SELECT * FROM rings");
Now later on I am adding all the rings in a slider
foreach($rings as $ring){
echo '<li> <input type="image" src="' . $ring['ringThumbNailImagePath'] . '" name="checked" value="" width="150" height="150" /></li>';
}
There is a label somewhere in code
<label for="ringName" id="ringName" style="color: #701344; font-size: 10pt" ></label>
Now on clicking the Ring I want to change text of label dynamically.
How can i do this in jquery.
I have done following things
Created a file : and added this in my main html <script src="js/jquery.rings.js"></script>
Contents are
$('input[type="image"]').click(function()
{
$ring = $(this).val();
$('label#ringName').text($ring['ringSetName']);
});
Also i changed the input to this
echo '<li> <input type="image" src="' . $ring['ringThumbNailImagePath'] . '" name="checked" value=$ring width="150" height="150" /></li>';
Howver on clicking nothing happens, how can i debug what is not working?