i am trying to educate mysely with jQuery by converting some old javascript code into the jQuery syntax but i seam to have hit a stumbling block, i am not very experienced with this language so please be easy on me…..lol.
I am trying to convert this to jQuery:
function getData (id) {
document.form1.numID.value = id;
document.form1.submit();
}
The id is passed by a javascript onClick event, this is then added to a hidden field and submitted with the form. The problem i am having is that when i bind jQuery to the click event for the div that was clicked i only ever get the first item in the repeat region to work, the rest do nothing, i have included the jquery i have gathered so far, i am assuming its because the divs are all named the same within the repeat region?;
$('#Editor').click(function () {
var id = $('#this').attr('value');
alert('You Clicked Edit Job '+id+'..!!');
});
I have just echoed this to an alert whilst i figure how to do this, the rest i can do just cannot seam to figure this out even after googling. Once i figure this i am then going to convert the old asp app into an ajax event.
<div id="Editor" value="123">Some database info displayed on the page</div>
<div id="Editor" value="456">Some more data info displayed on the page</div>
<div id="Editor" value="789">Even more info displayed from the database</div>
I have edited all the data out from the database, these divs are created based on the number of records returned from the database, i want to pass the “value” to another page where the id is used to get the item clicked. Hope this explains my dilemma a bit clearer.
id should be uniq! and using value attribute in DIV it’s not standard..
http://api.jquery.com/category/events/event-object/
demo: http://jsfiddle.net/mnsJT/2/