sharepoint 2010 - jquery code to get attachment name
===

In a sharepoint 2010 new form for a links list, I created a content editor webpart and put this jquery code in to get the filename for the attachment document (if user attached one).

Essentially I am trying to turn a links list into a document library in order to utilize its item ordering feature.

This is the code I am using in the new form.aspx page:

	<script type="text/javascript" src="jquery-1.7.2.min.js"></script>

	<script type="text/javascript">
		$('.ms-ButtonHeightWidth').eq(2).mousedown( function ( event ) {
			var my_array = $(".ms-vb");
			for (var i=0; i<my_array.length; i++) {
				text = $(my_array[i]).html();
				text = text.substring(1, text.length);
				text = text.substring(text.indexOf(">")+1, text.indexOf("<"));
				filename = text.substr(text.lastIndexOf("\\")+1);
				document.getElementById('ctl00_m_g_0440ff9f_32fb_44b5_8b6d_a9055bcb9806_ctl00_ctl05_ctl03_ctl00_ctl00_ctl04_ctl00_ctl00_TextField_inplacerte').innerHTML = filename;
			}
		});
	</script>

it basically puts a mouse down event on the save button, that changes a column field value to the attachment filename. its mouse down because it needs to happen before the save function occurs.
After this a workflow occurs and changes this column field value into a hyperlink to the document.

I want to know if the above code has no flaws. I mean like is it safe to use and won't break ever? Currently it works for me.